|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
can flash save state in a cookie?
I have a menu with sounds on rollover with a button to turn off the sound but when i leave the page flash movie reloads and my sound state is set back to default "ON". Is there a way to write a cookie in flash to save the state so that when I change pages it remembers my sound setting?
Thanks, Lito |
|
#2
|
||||
|
||||
|
If you're using flash MX, it has a great new feature called SharedObject, which functions like a cookie. (but it's not a cookie) I'm attaching an example file from the Macromedia Flash MX Developer's guide. I'll include the fla too, but here's the idea:
Code:
// how to define the sharedObject
myCookie = SharedObject.getLocal("cookiename");
// how to read
function readCookie() {
_root.variable = myCookie.data.someValue;
}
// how to write
function setCookie() {
myCookie.data.variable = someValue;
myCookie.flush()
}
There is a way to use actual cookies, but it involves using javascript to read/write it and then pass the variables to flash by dynamically writing attributes into the object tag. I can post that too if you want, but this way is much easier. |
|
#3
|
||||
|
||||
|
Thank you, I an using MX, I will try this out. But don't go too far I might have some questions for you.
lito |
|
#4
|
||||
|
||||
|
I need help!!!
Im a newbie in flash and a zero in action scripting, I am a bit confused about how flash action scripting references layers. The code you provided kinda makes sense but Im not too sure where to stick it... and how to have the button refference the functions. If I put those functions on a separate layer what would be the syntax to call those functions from a button? Another thing where would I position the function to read and write the cookie, in the button layer? or any where and flash knows they're global... thanks alot for helping me with this simple yet complicated problem of understanding action script consept. lito |
|
#5
|
||||
|
||||
|
I got it!!!
Well I got that part figures out by trial and error, but I would still appreciate any pointers or maybe a good link to tutorials and/or lessons on action scripting.
Thanks, Lito |
![]() |
| Viewing: Dev Shed Forums > Web Design > Flash Help > can flash save state in a cookie? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|