I have inserted my replay button into my flash movie and it works.
The problem is when I replay my movie some aspects of my animation do not work in the replay.
I believe this is because I have other timelines for movement e.g birds wings.
How do i implement code so that the entire movie will replay?
If your project is mostly animation and little to no code, you can place all of the animation into a MovieClip
. Export this symbol for ActionScript, giving it the class name Animation
.
Your replay button could simply remove the current instance of your animation and then re-attach it (which should reset the entire content).
Sample:
var animation:Animation;
replay.addEventListener(MouseEvent.CLICK _replay);
function _replay(e:MouseEvent = null):void
{
if(animation != null)
if(animation.parent)
animation.parent.removeChild(animation);
}
animation = new Animation();
addChild(animation);
}
_replay();