[help]Can CanvasSnapshot save using localStorage?

Discussion and feedback on Construct 2

Post » Fri Aug 05, 2016 5:18 am

there comes with a issue about the CanvasSnapshot,

e.g.
first test:
-on the start of layout -- system take snapshot of canvas
-- LoacalStorage set item "snapshot" to CanvasSnapshot
//-- wait 0 second
-- check "snapshot" exists
-on " sanpshot" exists -- text set text"Snapshot exists"
-- sprite load image from LocalStorage.ItemValue

then, text shows "Snapshot exists", but sprite load nothing...

another way the same step:
-on the start of layout -- system take snapshot of canvas
-- LoacalStorage set item "snapshot" to CanvasSnapshot
//-- wait 0 second
-- check "snapshot" exists
-on " sanpshot" exists -- text set text"Snapshot exists"
-- sprite load image from CanvasSnapshot

then, text shows "Snapshot exists", and sprite load the CanvasSnapshot

so does the localstorage cannot save the CanvasSnapshot?
how can i take the CanvasSnapshot then save it or load it?

looking forward to your replies, thanks!
B
72
S
25
G
5
Posts: 89
Reputation: 7,275

Post » Fri Aug 05, 2016 7:18 am

don't wait in the same event to check for item exists, it'll probably take more than 1 tick.

Add another event,

- localstorage - On Item Set "snapshot"
text set text"Snapshot exists"
-- sprite load image from LocalStorage.ItemValue
Image
B
76
S
28
G
12
Posts: 515
Reputation: 12,409

Post » Sat Aug 06, 2016 2:36 am

Lof wrote:don't wait in the same event to check for item exists, it'll probably take more than 1 tick.

Add another event,

- localstorage - On Item Set "snapshot"
text set text"Snapshot exists"
-- sprite load image from LocalStorage.ItemValue



thanks your reply,
i had been commented the "wait event",
and i add your advised events but doesn't work...
B
72
S
25
G
5
Posts: 89
Reputation: 7,275

Post » Sun Aug 07, 2016 8:53 am

Image
B
76
S
28
G
12
Posts: 515
Reputation: 12,409

Post » Mon Aug 08, 2016 12:52 am



OMG, i forgot the condition event " on canvas snapshot " and set localstorage value directly.
now it works!
thanks a lot !!!
B
72
S
25
G
5
Posts: 89
Reputation: 7,275


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 26 guests