Saturday, February 17, 2007
You want to dynamically call a certain movieclip before a movieclip is run.
Problem: You want to dynamically call a certain movieclip each time before a movieclip on the timeline is run.Solution:This can be achieved using attachMovie() and removeMovieclip() methods.
Lets see how this can be done.
Open a new document in Flash.
Create a circle(or any shape you want) and convert it to a moviclip.
Craete a small tweening animation of 25 frames.Now we have got a nice looking animation.In the last frame copy and paste this code
_root.gotoAndPlay(2)
this.removeMovieClip()
stop();
Then convert it into a new symbol.Give it a suitable name such as "transition" and let the identifier name remain "transition".Also select both checkboxes i.e, Export for Actionscript and Export at the first frame.
Open a new document and from the library drag the transition movieclip into the stage.Then delete it.Now this clip resides in the library of the new document.
In the First frame attach this code
_root.attachMovie("transition", "abc", 10);
stop();
Go to Frame 2 and create another movieclip and create small tweening animation.
Now test the movie.You will see the transition movie will play first and after it finishes the playhead will sart playing from frame 2 onwards.
