Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
martinella

videoLoader repeat

Recommended Posts

Hi all,

 

I'm loading a video that has to be repeated only 2 times.

What I need is a function that tell me when the video repeat is over.

 

This is the code:

 

var video:VideoLoader = new VideoLoader("video.f4v", {name:"myVideo", width:500, height:500, container:videoContainer, scaleMode:"none", autoPlay:false, bufferTime:2, repeat:1, volume:0, estimatedBytes:12255778, bufferMode:true, onComplete:completeHandler});

 

 

Somebody can help me? :D

Thanks

Link to comment
Share on other sites

I have the same problem! :ugeek:

I have a video that after finishing his loop, must be visible = false, but how can I know when the repeat is complete?

I already tried with video_complete but it just works for every repeat.

 

Thanks a lot!

Link to comment
Share on other sites

Hi MMaculatell,

i have a found a solution!!!!!

 

First you have to set a var for the number of the loop.

Then with the VIDEO_COMPLETE you can control the function.

 

Here an example:

 

var loop_counter:Number = 0;

myvideo.addEventListener(VideoLoader.VIDEO_COMPLETE, stopVideo);

 

function stopVideo(event:Event)

{

 

loop_counter++;

 

if (loop_counter == 2){

 

trace("here i'm");

 

}

}

 

 

If you have any questions let me know!!!

Thanks

Link to comment
Share on other sites

i don't think anything is built-in to handle that.

 

the following should work:

 

 

var playCount:Number = 0;//track times played

//add VIDEO_COMPLETE listener
video.addEventListener(VideoLoader.VIDEO_COMPLETE, donePlaying);

function donePlaying(e:LoaderEvent)
{
playCount++;
if (playCount 	{
//play again
       video.gotoVideoTime(0, true);

}else{
//don't play again
	trace("video done repeating");
	}

}

 

here everytime the VIDEO_COMPLETE event fires, you can increment a variable that keeps track of how many times the video has played.

 

you may want/need to remove the repeat:1 from the VideoLoader constructor. don't know.

 

 

 

EDIT: lol, :) looks like martinella beat me :) nice work!

Link to comment
Share on other sites

Hi!

Many thanks to all!!

Now it works super and I can control every loop thanks!!

:mrgreen:

Link to comment
Share on other sites

Hi Carl

Just for few seconds!!

Thank you so much anyway!!!!!! :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×