i need make animation called swing, done once when player hit spacebar or something. player have labeled timeline each label called ac3 , swap current label new one, problem facing need use mc once, , once finished go idle label. tried check currentframe '1' , not increasing, used solutions here :
stopping on last frame (flash)
with no luck @ all. not dealing actual mc, dealing frame , inside frame mc.
more illustration :
http://i.imgur.com/ciozu9l.png
any ideas ?
so see images need check frame of player.totoswing.currentframe
, before make sure totoswing
movieclip exists inside player. may not exist if currentframe
of player not 5.
so check current frame of animation this:
if(player.totoswing) trace(player.totoswing.currentframe);
if want stop @ last frame can add stop()
scirpt on last frame of totoswing movieclip.
if want know when totoswing animation goes end can following:
if(player.totoswing) { player.totoswing.addeventlistener(event.enter_frame, ontotoswingframe); player.totoswing.play(); } function ontotoswingframe(e:event):void { if(e.target.currentframe == e.target.totalframes) { //animation has ended e.target.removeeventlistener(event.enter_frame, ontotoswingframe); // whatever want. ex. play idle state } }
we first add listener enter_frame
event of player.totoswing
movieclip, fires event everytime advances frame. in event handler (ontotoswingframe
) check if player.totoswing
current frame equal total frames , if stop playback , know animation has finished. don't need enter_frame
listener anymore remove it.
Comments
Post a Comment