This content has been marked as final. Show 4 replies
maybe i didnt write that properly... what I mean is...
i have several instances of one child movie containg the variable ' thisVar' , how can I apply a different value to each of the child movies??
Not reliable to set variables in an external swf using loadMovie. The
problem is that the load timing is dependent on the network and not the
script. The loadMovie line does not pause the script until the external swf
is loaded. Thus the next line looking for the external swf can and probably
does execute before the movie is loaded.
You want to look at MovieClipLoader Actionscript class as a technique for
detecting when an external movie is loaded and ready for Actionscript.
An overview appears at
Probably the example for onLoadComplete is a good place to start:
However if you want to start using before the entire movie is loaded, you
can look ot onLoadInit also shown in the onLoadComplete example.
In the onLoadComplete method you can have targe_mc.thisVar = 1;
There are also other customized techniques using onEnterFrame and
setInterval to monitor the presence of a loaded external swf that you can
Flash, Actionscript and Flash Media Server examples:
May many happy bits flow your way!
"g1r2e3g" <firstname.lastname@example.org> wrote in message
So i have one main swf, that dynamically loads in several copies of another
Within the Child movie there are buttons that call out to the HTML to
ID variable set by the container film..
Can someone show me a working version of the following as I cannot find
anything that can pass a variable to the child.
child1.thisVar = 1;
child2.thisVar = 2;
Most likely your problem is that you aren't waiting until "child.swf" has finished loading into child1. Any properties, code, variables attached to child1 will be replaced once the external file loads completely.
You need a preloader to wait until the clip is completely loaded and then assign your ID. If you need help with that we can work it out.
If you are publishing for Flash 7 or higher, I recommend using the MovieClipLoader class. You could then use the onLoadInit event to assign your ID.
Of course I'm not understanding the need for a unique ID. If they all have unique names, e.g. child1, child2, etc., then that could be your unique ID. Just a thought!
(PS why call it thisVar – a combination of two reserved words which is likely to cause confusion – when myID seems so much more sensible.)
I am pubilshing for flash 6. Also my variable wasn't actually caled thisVar, sorry about that. Also, calling it a unique ID may not have made sense..
basically the child movie is a set of 24 buttons that represent time values (1 hour blocks) over a 24 hour period. This movie as I said is repeated many time as each new instance represents different activities that the user needs to specify as completed over the 24 hours.
So in the child movie each of the buttons calls
How can I set the value activityID within each instance of the movie?