PDA

View Full Version : Can Anyone Help With Action Scritps



ManJonStudios
12-22-2004, 04:39 PM
I am looking to make a small swf file that will play an audio track when someone reaches my site. I only want it to play 1 time. I know there are browser scripts that will track browser activity and allow you to do this outside of Flash, but I need to learn how to do it using just flash. Any thoughts?

mikmik
12-24-2004, 03:32 AM
Still no answer? I wish I could help.

Are meaning like a session cookie so it only plays once per visit, so it doesn't reload every time they go back to the start/index page?

You would still need to store the IP info outside of the SWF, I think. (Trying to spur some discussion) ;P

ManJonStudios
12-24-2004, 11:32 AM
So how would that work. Like a java script that I refer to in the action script of the swf?

mikmik
12-24-2004, 12:50 PM
I guess you CAN do it using just flash!

You have to use something called 'SharedObject' that you create in the first frame of the movie like

local_data = SharedObject.getLocal("played_data");
local_data.data.played_yes = "True";
local_data.flush ()

stored_played_yes = local_data.data.played_yes;

which creates a record on the client machine and so your movie can be set to look for this 'cookie', and if it is present, not to play.

I am just learning this as I read it, so I am not sure all the commands or how to use this data yet, like a preloader that looks for a value I guess, but to play when the value is null, and not to play when true.

I don't really know how to use action script LOL, I was hoping someone else would help, but here is the information to use yhis local and remote data store and retrieval:
Using local shared objects in Macromedia Flash MX (http://www.macromedia.com/support/flash/action_scripts/local_shared_object/)

Good luck! There may be tutes elsewhere on specific situations, I would imagine. Maybe kirupa and cbtCafe etc.

ManJonStudios
12-29-2004, 03:47 AM
Thanks for your help, I checked out those sites and they were very helpful. Gotta love the help you get from Web Pro World! Thanks again.