Play next movie after FLV movie is complete
if stream is your NetStream class, at some point you need to hook up an onStatus event handler.
Code:
******************************************************************
stream.notify = this;
stream.onStatus = function( s ) { notify.onStatus( s ); };
******************************************************************
this being our video "component", the class that contained the NetStream object.
Then our onStatus handler was:
Code:
******************************************************************
function onStatus( status )
{
switch( status.code ) {
case "NetStream.Buffer.Empty": onEmpty(); break;
case "NetStream.Buffer.Full": onFull(); break;
case "NetStream.Buffer.Flush": onFlush(); break;
case "NetStream.Play.Start": onStart(); break;
case "NetStream.Play.Stop": onStop(); break;
case "NetStream.Play.StreamNotFound": onStreamNotFound(); break;
case "NetStream.Seek.InvalidTime": onInvalidSeek(); break;
case "NetStream.Seek.Notify": onSeekReady(); break;
}
}
******************************************************************
And finally you want onStop to do your gotoAndWhatever.
If I recollect you do need to interpret the state depending on what else may be going on ... are you already playing etc etc... So our onStop handler looked like:
Code:
******************************************************************
function onStop()
{
cancelTask( "monitor" );
if( statePlaying ) {
// YOUR GOTO AND WHATEVER CODE COULD GO HERE
statePlaying = false;
notify( "stop", this );
deferCall( styleDeferRewindOnStop, onStop2 );
}
}
******************************************************************
BTW... functions like deferCall, notify, cancelTask, are all our own... not Flash or V2 related.
In our case, when the movie stopped, and if styleDeferRewindOnStop was greater than 0, the movie went back to it's beginning and stopped:
Code:
******************************************************************
function onStop2()
{
stream.seek( 0 );
}
******************************************************************
Code:
******************************************************************
stream.notify = this;
stream.onStatus = function( s ) { notify.onStatus( s ); };
******************************************************************
this being our video "component", the class that contained the NetStream object.
Then our onStatus handler was:
Code:
******************************************************************
function onStatus( status )
{
switch( status.code ) {
case "NetStream.Buffer.Empty": onEmpty(); break;
case "NetStream.Buffer.Full": onFull(); break;
case "NetStream.Buffer.Flush": onFlush(); break;
case "NetStream.Play.Start": onStart(); break;
case "NetStream.Play.Stop": onStop(); break;
case "NetStream.Play.StreamNotFound": onStreamNotFound(); break;
case "NetStream.Seek.InvalidTime": onInvalidSeek(); break;
case "NetStream.Seek.Notify": onSeekReady(); break;
}
}
******************************************************************
And finally you want onStop to do your gotoAndWhatever.
If I recollect you do need to interpret the state depending on what else may be going on ... are you already playing etc etc... So our onStop handler looked like:
Code:
******************************************************************
function onStop()
{
cancelTask( "monitor" );
if( statePlaying ) {
// YOUR GOTO AND WHATEVER CODE COULD GO HERE
statePlaying = false;
notify( "stop", this );
deferCall( styleDeferRewindOnStop, onStop2 );
}
}
******************************************************************
BTW... functions like deferCall, notify, cancelTask, are all our own... not Flash or V2 related.
In our case, when the movie stopped, and if styleDeferRewindOnStop was greater than 0, the movie went back to it's beginning and stopped:
Code:
******************************************************************
function onStop2()
{
stream.seek( 0 );
}
******************************************************************
Nhận xét
Đăng nhận xét