Function ActionScript 3.0-一个函数中包含2个gotoAndPlay()命令

Function ActionScript 3.0-一个函数中包含2个gotoAndPlay()命令,function,actionscript,command,Function,Actionscript,Command,我有以下Adobe Flash(ActionScript 3.0)电影: 当按下按钮时,我想播放第17帧到第24帧,之后,我想返回并在同一动画中播放第10帧到第16帧。我尝试过类似的方法,但不幸的是,它不起作用: button.addEventListener(MouseEvent.CLICK, buttonClick); function buttonClick(event:MouseEvent):void{ gotoAndPlay(17); gotoAnd

我有以下Adobe Flash(ActionScript 3.0)电影:

当按下按钮时,我想播放第17帧到第24帧,之后,我想返回并在同一动画中播放第10帧到第16帧。我尝试过类似的方法,但不幸的是,它不起作用:

button.addEventListener(MouseEvent.CLICK, buttonClick);

function buttonClick(event:MouseEvent):void{
        gotoAndPlay(17);
        gotoAndPlay(10);
}
换句话说:在
gotoAndPlay之后(17)我想
去玩(10)

谢谢你的关注

试试这个:

stop();


// Properties.
var queue:Array = [];
var currentBlock:Point;


// Queue a section of timeline to play.
function queueBlock(start:int, end:int):void
{
    queue.push(new Point(start, end));
}


addEventListener(Event.ENTER_FRAME, enterFrame);
function enterFrame(e:Event):void
{
    if(!currentBlock)
    {
        if(queue.length > 0)
        {
            // Select and remove first block to play.
            currentBlock = queue[0];
            queue.splice(0, 1);

            gotoAndPlay(currentBlock.x);
        }
    }
    else
    {
        play();

        if(currentBlock.y == currentFrame)
        {
            // Got to the end of the block, end it.
            currentBlock = null;
            stop();
        }
    }
}
这将允许您执行以下操作:

// Demo:
queueBlock(17, 24);
queueBlock(10, 16);
试试这个:

stop();


// Properties.
var queue:Array = [];
var currentBlock:Point;


// Queue a section of timeline to play.
function queueBlock(start:int, end:int):void
{
    queue.push(new Point(start, end));
}


addEventListener(Event.ENTER_FRAME, enterFrame);
function enterFrame(e:Event):void
{
    if(!currentBlock)
    {
        if(queue.length > 0)
        {
            // Select and remove first block to play.
            currentBlock = queue[0];
            queue.splice(0, 1);

            gotoAndPlay(currentBlock.x);
        }
    }
    else
    {
        play();

        if(currentBlock.y == currentFrame)
        {
            // Got to the end of the block, end it.
            currentBlock = null;
            stop();
        }
    }
}
这将允许您执行以下操作:

// Demo:
queueBlock(17, 24);
queueBlock(10, 16);