1

次の Adob​​e Flash (ActionScript 3.0) ムービーがあります。

ここに画像の説明を入力

ボタンを押すと17~24フレームを再生し、その後10~16フレームを同じアニメーションで再生したい。私はこのようなことを試しましたが、残念ながらうまくいきません:

button.addEventListener(MouseEvent.CLICK, buttonClick);

function buttonClick(event:MouseEvent):void{
        gotoAndPlay(17);
        gotoAndPlay(10);
}

言い換えれば、gotoAndPlay(17);私がしたい後gotoAndPlay(10);

、あなたの注意をありがとう!

4

1 に答える 1

1

これを試して:

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);
于 2012-07-09T02:36:45.960 に答える