0

I'm using the flash's video player to play a clip, autoplay is set to false. I need to trigger mc1 playing when the play button is first clicked, and trigger mc2 when the video completes.

Now I know how to do the complete trigger with:

videoPlayer.addEventListener(VideoEvent.COMPLETE, vidCompleteHandler);

But I have no idea what video event I need for when the video first plays, because I don't want mc1 to be triggered everytime the play button is clicked (i.e. if people click pause then play again, i don't want mc1 to be triggered again).

Can someone help me with this?

4

1 に答える 1

0

最初に NetStream オブジェクトをビデオ オブジェクトにアタッチしてから、特定の開始イベントをリッスンする必要があります。次のようになります。

// create a new net connection, add event listener and connect
// to null because we don't have a media server
ncConnection = new NetConnection();
ncConnection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
ncConnection.connect(null);

// create a new netstream with the net connection, add event
// listener, set client to this for handling meta data and
// set the buffer time to the value from the constant
nsStream = new NetStream(ncConnection);
nsStream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
nsStream.client = this;
nsStream.bufferTime = BUFFER_TIME;

// attach net stream to video object on the stage
vidDisplay.attachNetStream(nsStream);

function netStatusHandler(event:NetStatusEvent):void {
switch (event.info.code) {
    case "NetStream.Play.Start":
        yourStartFunction();
    break;
}

}

于 2012-05-14T15:39:20.803 に答える