I want to add the following script in my action script for redirecting to first frame after the external video finish,
But I’m not sure how to customize the code that suitable for my sction script.
This is the code I want to add with my AS :
ns.onStatus = function(info:Object)
{
if(info.code == 'NetStream.Play.Stop')
{
gotoAndPlay(2);
}
}
The following one is the original code now I’m using to play external video files. I need to customize the above code that should be usable for the below one.
function checkTime(flv)
{
var _loc2 = flv.playheadTime;
var _loc3 = Math.floor(_loc2 / 60);
var _loc1 = Math.floor(_loc2 % 60);
if (_loc1 < 10)
{
_loc1 = "0" + _loc1;
} // end if
current_time.text = _loc3 + ":" + _loc1;
} // End of the function
flv.pauseButton = pause_btn;
flv.playButton = play_btn;
flv.FLVPlayback.align = center;
var time_interval = setInterval(checkTime, 500, flv);
ffwd_btn.onRelease = function ()
{
flv.seek(flv.playheadTime + 2);
};
rewind_btn.onRelease = function ()
{
flv.seek(flv.playheadTime - 5);
};
mute_btn.onRelease = function ()
{
if (videoSound.getVolume() == 0)
{
videoSound.start();
videoSound.setVolume(volLevel);
}
else
{
volLevel = _root.videoSound.getVolume();
videoSound.setVolume(0);
videoSound.stop();
} // end else if
};
var videoSound = new Sound(this);
videoSound.setVolume(100);
flv.contentPath = flvurl;
fl.video.FLVPlayback.align = center;
Can anyone help me?
since you are using AS2, and the
completeevent firing is inconsistent with the FLVPlayback component in AS2 AND you are already polling withsetInterval, just compare the videodurationto theplayheadTimein youcheckTime()function like so:note that the
durationis nested inside themetadataproperty of theFLVPlaybackinstance. It’s not available until enough of the flv file has loaded, but since you are polling with your interval, it will be there when you need it.should get ya what ya want…