Thursday, October 13, 2011

Making the Stop/Start Movie

1. Make a new .fla file. Called 'startstop.fla' (or whatever)

2. Convert your main simulation timeline animation into a MovieClip so that you can import it to your new file.

-- Follow These Steps Link Here --

3. Open your new .fla

4. Make 3 layers: 1. actions, 2. buttons, 3. animation

5. Make a play and a stop button symbol. Animate the OVER state.

6. Add your play and stop buttons to the stage on the buttons layer.

7. Select your buttons on the stage (one at a time). in PROPERTIES, name the Instance Name: stop_btn, or play_btn

8. Place your animation MovieClip onto the stage and into the animation layer. Select the MovieClip on the stage. Name the Instance Name in the PROPERTIES panel name_mc (or whatever)

9. In the actions layer add the following actionscript:

----------------------

var movieclip:MovieClip;

function stopMovieClip(mc:MovieClip):void{
mc.stop();
for (var i:int = 0; i < mc.numChildren; i++)
var mcChild = mc.getChildAt(i);
if (mcChild is MovieClip) stopMovieClip(mcChild);

}

function playMovieClip(mcPlaying:MovieClip):void{
mcPlaying.play();
for (var j:int = 0; j < mcPlaying.numChildren; j++)
var mcPlay = mcPlaying.getChildAt(j);
if (mcPlay is MovieClip) playMovieClip(mcPlay);
}


stop_btn.addEventListener(MouseEvent.CLICK, stopAll);

function stopAll(event:MouseEvent):void
{
stopMovieClip(ball_mc);

}


play_btn.addEventListener(MouseEvent.CLICK, PlayMC);

function PlayMC(event:MouseEvent):void
{
playMovieClip(ball_mc);
}


----------------------

10. In the actionscript change my code/movie names [ written above in bold] with your movie's PROPERTY Instance Names

11. take notes in class.

No comments:

Post a Comment