all groups > flash actionscript > february 2006 >
You're in the

flash actionscript

group:

action script 2.0



Re: action script 2.0 manifestinteractive NO[at]SPAM gmail.com
2/25/2006 7:53:08 PM
flash actionscript: Greetings,

You should be able to change you ecomplete function to make this work.
Here is my version. Give it a go and let us know if it worked for you:

function ecomplete(e:Object):Void {
++videoPlayerIndex;
if(videoPlayerIndex >= videoList.length) {
vidComp.stop(); // We are at the end of the videoList
}
else {
vidComp.activeVideoPlayerIndex = videoPlayerIndex;
vidComp.visibleVideoPlayerIndex = videoPlayerIndex;
vidComp.play(); // There are more videos to play
}
}
action script 2.0 kewlj
2/25/2006 11:48:52 PM
I'm using the script below (from theFlash pro 8 training guide) to load two
videos (one after another). The way it's written it continuously loops through
both videos. Is there a way to play both and stop at the end - ready to replay?


var videoLoaderIndex:Number = 0;
var videoPlayerIndex:Number = 0;
var videoList:Array = new Array( "l_ad2.flv", "l_int.flv");

vidComp.contentPath = videoList;

function eready(e:Object):Void {
if( videoLoaderIndex < videoList.length ) {
videoLoaderIndex++;
vidComp.activeVideoPlayerIndex = videoLoaderIndex;
vidComp.load( videoList );
}
}

vidComp.addEventListener("ready", eready);
function ecomplete(e:Object):Void {
++videoPlayerIndex;
if(videoPlayerIndex >= videoList.length) {
videoPlayerIndex = 0;
}

vidComp.activeVideoPlayerIndex = videoPlayerIndex;
vidComp.visibleVideoPlayerIndex = videoPlayerIndex;
vidComp.play();
}

vidComp.addEventListener("complete", ecomplete );


Re: action script 2.0 blemmo
2/26/2006 3:03:09 PM
Try this in the ecomplete event:
if(videoPlayerIndex >= videoList.length) {
videoPlayerIndex = 0;
return;
}

This should set the index to the first movie and return, avoiding the play
call later in the event.

greets,
blemmo
Re: action script 2.0 kewlj
2/26/2006 4:57:38 PM
Thanks, blemmo I'm new to flash and that change is a lot closer than I got.
But, although it stops at the end of both videos - when you play it again it
only plays the second video and loops through it twice. Any thoughts?
Re: action script 2.0 blemmo
2/26/2006 5:08:33 PM
Try to set 'videoLoaderIndex' also to 0:

if(videoPlayerIndex >= videoList.length) {
videoPlayerIndex = videoLoaderIndex = 0;
return;
}

This is quite complex code for Flash starters... Hope I could help with it.

cheers,
blemmo
Re: action script 2.0 kewlj
2/26/2006 5:19:53 PM
I changed setting the videoPlayerindex = 0 to videoPlayerindex =1 (with the
return; you suggested). It plays both videos and stops then plays the second
video one time with each replay - this works great for my application since the
first vid is an ad they've already been forced to watch once. Thanks for your
help!
AddThis Social Bookmark Button