Flash CS5 Actionscript 3.0 Go to Next Frame and Play Code

59,779
playBtn.addEventListener(MouseEvent.CLICK, fl_Click_Play);

function fl_Click_Play(event:MouseEvent):void
{
    MovieClip(root).play();
}

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:

MovieClip(this.parent).play();

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.

Share:
59,779
Stephanie
Author by

Stephanie

Web designer, SEO specialist and owner of www.withloveragan.com clothing boutique.

Updated on April 19, 2020

Comments

  • Stephanie
    Stephanie about 4 years

    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);
    }