On Feb 26, 2006, at 6:30 PM, Shy Aberman wrote:
Try passing in the function name as a string.
Ah, thanks for the tip. :)
Got it working now! On top of what you mentioned above I had to change
a few other things I over-looked... see comments below:
/* Update: Changed second argument to a "string". */
_root.stopButton.onRelease = function() { startStopMovies(_root,
"stop"); };
/* Update: Changed second argument to a "string". */
_root.startButton.onRelease = function() { startStopMovies(_root,
"play"); };
//// Function that will stop all movies on all timelines:
startStopMovies = function(location, control) {
for(var movie in location) {
if(typeof(location[movie]) == "movieclip") {
/* Update: Make the stop()/start() apply to the movies
scope: */
location[movie][control]();
/* Update: I needed to re-call this function, and I also forgot to
add the second argument - I think main reason why things were broke
previously: */
startStopMovies(location[movie], control);
}
}
/* Not exactly sure if this is necessary, but it works so I am leaving
it: */
_root[control]();
};
Well, that is it. Thanks all for you help. I hope this will help
someone else.
Please let me know if I can improve upon this code.
Many thanks all.
M
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com