Flash Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignFlash Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 22nd, 2003, 12:31 PM
lito's Avatar
lito lito is offline
MACTEP /\OMACTEP
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: Seattle, WA
Posts: 150 lito User rank is Private First Class (20 - 50 Reputation Level)lito User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 6 h 46 m 51 sec
Reputation Power: 6
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

Reply With Quote
  #2  
Old July 22nd, 2003, 04:27 PM
blatant's Avatar
blatant blatant is offline
World Domination
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: San Diego
Posts: 126 blatant User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 47 m 17 sec
Reputation Power: 6
Send a message via AIM to blatant
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.
Attached Files
File Type: zip 09localsharedobject.zip (26.1 KB, 568 views)

Reply With Quote
  #3  
Old July 24th, 2003, 02:56 PM
lito's Avatar
lito lito is offline
MACTEP /\OMACTEP
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: Seattle, WA
Posts: 150 lito User rank is Private First Class (20 - 50 Reputation Level)lito User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 6 h 46 m 51 sec
Reputation Power: 6
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

Reply With Quote
  #4  
Old July 24th, 2003, 05:40 PM
lito's Avatar
lito lito is offline
MACTEP /\OMACTEP
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: Seattle, WA
Posts: 150 lito User rank is Private First Class (20 - 50 Reputation Level)lito User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 6 h 46 m 51 sec
Reputation Power: 6
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

Reply With Quote
  #5  
Old July 25th, 2003, 12:27 PM
lito's Avatar
lito lito is offline
MACTEP /\OMACTEP
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: Seattle, WA
Posts: 150 lito User rank is Private First Class (20 - 50 Reputation Level)lito User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 6 h 46 m 51 sec
Reputation Power: 6
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

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignFlash Help > can flash save state in a cookie?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway