I am coding a simple movie timeline in Flash CS5 actionscript 3.0. I have all my buttons working except for the Play button which I would like to code to say “go to next frame and play”. Here is my current actionscript can anyone help me to find the correct code?
fastforwardBtn.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame);
function fl_ClickToGoToAndStopAtFrame(event:MouseEvent):void
{
gotoAndStop(4025);
}
stop();
gotoStopBtn.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_2);
function fl_ClickToGoToAndStopAtFrame_2(event:MouseEvent):void
{
gotoAndStop(1);
}
gotoPlayBtn.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame);
function fl_ClickToGoToAndPlayFromFrame(event:MouseEvent):void
{
gotoAndPlay(1);
}
stopBtn.addEventListener(MouseEvent.CLICK, fl_ClickToGoToNextFrame_2);
function fl_ClickToGoToNextFrame_2(event:MouseEvent):void
{
nextFrame();
}
playBtn.on (release) ;{
_root.gotoAndPlay(_currentframe+1);
}
should work, if you have a simple fla. And if that doesn’t seem to work, you may need something like this to target the right path:
Without knowing your fla structure, its just a guess 😉
also = _root is AS2, and always targets _level0. This is changed in AS3 to just “root”, and targets the timeline of the topmost displayObjectContainer.