AS3:play and stop/pause button!

Started by: sotech | Replies: 0 | Views: 3,229

sotech

Posts: 908
Joined: Oct 2012
Rep: 10

View Profile
Mar 7, 2013 9:20 PM #907365
so,first make some anim,like this for example(dont talk about the anim):
http://www.filz.us/rP6
and our goal is
http://www.filz.us/rP5

How?
1.First make or select an animation,be sure it is AS3
2.make 3 new layers,one with stop button,secound with play button,and third with actions
3.after you make a button,convert it to a button(<_<) and give them the intense names playbtn and stopbtn
4.selects the actions layer,press f9 and type the following code:
import flash.events.MouseEvent;

playbtn.addEventListener(MouseEvent.CLICK,playNow)

function playNow(e:MouseEvent){
play();
}

stopbtn.addEventListener(MouseEvent.CLICK,stopNow)

function stopNow(e:MouseEvent){
stop();
}


Hope it helps :)