This content has been marked as final.
Show 1 reply
-
1. Re: GotoAndPlay immediately after content is loaded fails
Newsgroup_User Jul 15, 2006 2:05 PM (in response to Newsgroup_User)If you place this code you posted on frame 1 and create two movie clips with
"instance names" as in the code. It works just fine.
function doSomething():Void {
mc1.mc2.gotoAndPlay(2);
trace(mc1.mc2._currentframe); // is 2 but the playhead stops in
frame 2
}
doSomething();
So there must be something in the complexity of you Movie that is
interferring. It could be something a simple as two MovieClip instances with
the same name, unnamed instances, or relative paths to the instances. It
could be something more involved if you are loading external movies into mc1
or mc2. In that case you have a timing issue and need to know when the
external swf is loaded. You can look at the MovieClipLoader class for
external swf loading timing handlers.
The timer should not be necessary if all the mcs are in the same movie.
--
Lon Hosford
www.lonhosford.com
Flash, Actionscript and Flash Media Server examples:
http://flashexamples.hosfordusa.com
May many happy bits flow your way!
"NilsB" <nburdin@fbawg.hs-bremen.de> wrote in message
news:C0DD4363.D2D%nburdin@fbawg.hs-bremen.de...
> Hello,
> I'm trying to do a gotoAndPlay in a complex movieclip structure from the
> main timeline.
>
> The following code works perfectly:
>
> function doSomething():Void {
> mc1.mc2.gotoAndPlay(2);
> clearInterval(intervalId);
> }
>
> var intervalId:Number = setInterval(doSomething, 1);
>
> The following code does _not_ work:
>
> function doSomething():Void {
> mc1.mc2.gotoAndPlay(2);
> trace(mc1.mc2._currentframe); // is 2 but the playhead stops in
> frame 2
> }
>
> doSomething();
>
>
> Here are my questions:
> 1. Why does my code work when I simply wait for one millisecond before
> calling the function that does the gotoAndPlay (or what do I have to wait
> for, because none of the attributes are undefined).
> 2. What is the flash player doing when loading the movieclips.
> 3. Is there a document describing the internal work the flashplayer is
> doing when loading the clips (i.e. Like registering movieclips).
>
> Thanks for any help.
>