1

特定のフレームを離れたときに何らかの機能を実行するための AS3 スクリプトが本当に必要です。

私の理由は、FLV再生を含むフレームを終了した後、ビデオを停止してmp3プレーヤーのサウンドを再開する機能を配置することです。


私はこのスクリプトを使用していますが、FLash プロジェクターではうまく機能しますが、stage.invalidate(); flv 再生フレームを終了しようとした後、Swfkit や Zinc などのサードパーティ アプリケーション メーカーが応答しません。

ここに私のスクリプトがあります:

stage.invalidate();

mene.addEventListener(Event.RENDER,exitingF);
mene.addEventListener(Event.REMOVED_FROM_STAGE, removedF);

function exitingF(e:Event):void{

            controller.gotoAndStop(2);
            pausePosition = sndChannel.position; 
            sndChannel.stop();
            isPlaying = false;
}


function removedF(e:Event):void{
            mene.stop();
            controller.gotoAndStop(1);
            sndChannel = soundClip.play(pausePosition);
            isPlaying = true;
}

私が必要とするのは、特定のフレームを終了した直後にフラッシュを実行するという別の方法です(別のフレームに移動します)

4

1 に答える 1

0

機能を使ってみてくださいaddFrameScript()

次のように機能します。OBJECT.addFrameScript(FRAME, CALLBACK)

これにより、スクリプトがタイムラインに追加され、指定されたフレームに到達するたびにコールバックが実行されます。

私が見つけた例を次に示します: http://blog.newmovieclip.com/2007/04/30/add-a-frame-script-addframescript-dynamically-in-flash-cs3/

package com.newmovieclip{
import flash.display.MovieClip;
public class Main extends MovieClip {
public var myStar:Star;
         //constructor
public function Main() {
    //place a star on stage
    myStar = new Star();
    addChild(myStar);
    //add script to star timeline on frame 5
    myStar.addFrameScript(4,frameFunction); // (zero based)
}
private function frameFunction():void {
    trace("Executing  code for star Frame  5" );
    //delete frame script by passing null as second parameter
    myStar.addFrameScript(4,null);
        }
}
}

例のインライン コメントに記載されているように、フレームは 0 ベースであることに注意してください。

于 2013-08-21T18:55:53.357 に答える