Mute Audio - Webstorage

Get help using Construct 2

Post » Wed Dec 18, 2013 8:01 am

Hi

Got my mute-btn to work fine, now I want it to be remembered in
int(WebStorage.SessionValue("MutedStored"))

BUT how can I do that ?






Regards
Flemming
B
33
S
17
G
11
Posts: 350
Reputation: 8,690

Post » Wed Dec 18, 2013 8:46 am

Tutorial on webstorage

You have to set the local value to the global variable

And make an event to load the key when needed.

I'm not sure why you'd need mutestored, for saving the global variable is muted and loading it back would work.

I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sat Dec 21, 2013 5:27 pm

Me again

Cant figure out what I am doing wrong

Want the mute toggle to be stored as session



Regards
Flemming
B
33
S
17
G
11
Posts: 350
Reputation: 8,690

Post » Sun Dec 22, 2013 9:55 am

No Idears ? :-(




B
33
S
17
G
11
Posts: 350
Reputation: 8,690

Post » Sun Dec 22, 2013 11:58 am

try this

B
38
S
13
G
4
Posts: 152
Reputation: 5,142

Post » Sun Dec 22, 2013 5:13 pm

Thanks thanks ..always learning in here :-)

Merry christmas and thanks again
B
33
S
17
G
11
Posts: 350
Reputation: 8,690

Post » Mon Dec 23, 2013 4:08 pm

Hi

Cant get it working right.. seams as it only works after the MuteBtn has been triggered first time

In a fresh browser it says Nan

Ive put my simple capx here



AudioMute - webstorage


Hope someone can help me out getting it to work
I must be missing something


Regards
flemming
B
33
S
17
G
11
Posts: 350
Reputation: 8,690

Post » Mon Dec 23, 2013 4:12 pm

You should check if the webstorage key exists before setting ismuted.

add a subevent to the on start of layout and set it to
Local key exists "ismuted" - and add the events to set from webstorage as actions to that event.

you can't set ismuted to a value that doesn't exist.

LittleStain2013-12-23 16:13:49
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Tue Dec 24, 2013 7:34 am

Hi Thanks!... but no luck with that :-(



Here my capx


Regards
flemming
B
33
S
17
G
11
Posts: 350
Reputation: 8,690

Post » Tue Dec 24, 2013 7:41 am

NaN means not a number.

Webstorage is saved as a string.
You are forgetting to convert the string into an integer.
if you put int() around the webstorage like in the above example by anata, you convert the string into an integer.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Next

Return to How do I....?

Who is online

Users browsing this forum: MadSpy and 3 guests