Jump to content
Search Community

Loadermax Newbie - Video Playback & Status

ukmikeb test
Moderator Tag

Recommended Posts

Hi,

 

You loaderMax tools are awesome, but I can't seem to find any examples for what I need.. and I am urgently in need of them !!!

 

I have loaded a set of assets using:

public var queue:LoaderMax = new LoaderMax({name:"mainQueue", onProgress:progressHandler, onComplete:completeHandler, onError:errorHandler});

 

and within a loop added the assets to the queue:

queue.append( new VideoLoader(vURL, {name:"v_"+i, estimatedBytes:2350000}) );

queue.append( new ImageLoader(vThumbURL, {name:"vThumb_"+i, estimatedBytes:8500}) );

queue.append( new ImageLoader(vMapURL, {name:"vMap_"+i, estimatedBytes:3000}) );

 

started loading:

queue.load();

 

then when the completes it's load, i'm displaying the video, no problem:

var video:ContentDisplay = LoaderMax.getContent("v_1");

addChild(video);

 

NOW.. THIS IS WHERE I AM LOST:

 

1) How do access the properties of the video: like VIDEO_COMPLETE (so I know when it's finished) & others

2) how do I control the playback: playVideo() etc...

 

Nothing I try seems to be working??

I am guessing using ContentDisplay won't allow me these functions, but not sure how else to play the videos in my queue?

 

Please help! (quickly if possible ;) )

 

Thanks

 

Mike

Link to comment
Share on other sites

There's actually a very detailed example of EXACTLY what you're trying to do here:

http://active.tutsplus.com/tutorials/ac ... e-premium/

 

To answer your question, you control the video (and add listeners) using the VideoLoader itself, not the ContentDisplay. Like:

 

myVideoLoader.addEventListener(VideoLoader.VIDEO_COMPLETE, videoCompleteHandler);
myVideoLoader.playVideo();

function videoCompleteHandler(event:LoaderEvent):void {
   trace("finished playing VideoLoader: " + event.target);
}

 

For more learning resources, check out http://www.greensock.com/learning/ and scroll down to the LoaderMax header.

Link to comment
Share on other sites

Great!!!

 

Thanks soo much for your quick reply..

 

So i've done this, and it seems to be working a treat!

 

var videoLdr:VideoLoader = LoaderMax.getLoader("v_1");
trace("duration:" + videoLdr.duration)

var videoContent:ContentDisplay = LoaderMax.getContent("v_1");
addChild(videoContent);

videoLdr.addEventListener(VideoLoader.VIDEO_COMPLETE, videoCompleteHandler);
videoLdr.playVideo();

function videoCompleteHandler(event:LoaderEvent):void {
trace("finished playing VideoLoader: " + event.target);
}

 

Thanks Again.. awesome support!

 

Mike

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.
×
×
  • Create New...