Jump to content


LoaderMax - VideoLoader (pauseVideo) bug?

Recommended Posts


I am using the VideoLoader class. I have multiple videoclasses in my page and am trying to loop to the VideoLoader classes and run the pauseVideo

method, but it's collapsing and giving errors on the setter videoPaused.

I tried debugging and it's giving error's starting from _setForceTime(0); I tried uncommenting each line after, but it seems that even the _ns object = null, like the _sprite =null and so on.


This is all my code i used to setup the VideoLoaders. What am i doing wrong? Or is this a bug?

And is it possible to play multiple video's at once? Now they only played after they are loaded completely. I would like to have them played like youtube.. progressively, is that build in?


public function startLoadingAllVideos():void {


_vidurls = [];

_vidLoadersArray = [];

for (var i:int = 0; i < vidholdersArray.length-1 ; i++) {

_vidurls.push("video/page5/wo_" + (i + 1).toString() + ".f4v");


var que: LoaderMax = LoaderMax.parse(_vidurls, { maxConnections:1, autoDispose:true, repeat:-1, onChildComplete:childCompleteHandler, onComplete:queCompleteHandler});




private function childCompleteHandler(event:LoaderEvent):void {

trace("on child complete handler");

var videoLdr :VideoLoader = LoaderMax.getLoader(_vidurls[_vidcounter]);


videoLdr.volume = 0;

var vidcontent : ContentDisplay = videoLdr.content;

var holder : MovieClip = vidholdersArray[_vidcounter] as MovieClip;

vidcontent.width = holder.width;

vidcontent.height = holder.height;





private function queCompleteHandler(event:LoaderEvent):void {

trace("on que complete handler");

} }


public function pauseAllVideos():void {

for (var i:int = 0; i < _vidLoadersArray.length; i++) {

var videoLdr:VideoLoader = _vidLoadersArray as VideoLoader;




Link to comment
Share on other sites

And is it possible to play multiple video's at once? Now they only played after they are loaded completely


yes, multiple videos should be able to play simultaneously.


are you sure they only start playing after they are fully loaded? or are you just seeing them after they are fully loaded?

The reason I ask is that you don't add the video content to the holder until the childComplete handler fires.

unlike an image, a video can be displayed and play before it is completely loaded.




also I wonder if your pauseVideo() isn't working because you are looping through your vidLoaders array, but those loaders MIGHT have been nuked by the que's autoDispose:true. not sure.




what I might suggest is instead of dynamically creating an array of image urls and then parsing that array. you might get better control (more than what the VideoLoader defaults are) over setting container clips for each loader, then you won't have to add them to holders after they load. something like:


var que: LoaderMax = new LoaderMax({onComplete:queCompleteHandler});

//build your que out of individual VideoLoaders:
for (var i:int = 0; i 
//each loader has unique, url, name and container:
var video:VideoLoader = new VideoLoader("video/page5/wo_" + (i + 1).toString() + ".f4v", {name:"myVideo" + i, container:vidHoldersArray[i], autoPlay:true, volume:0, onComplete:childCompleteHandler});


//loop through all the loaders in the que and pause
public function pauseAllVideos():void { 
  for (var i:int = 0; i    que.getChildIndex(i).pauseVideo();



--note the above is untested, and if you try to use it you will have to change a lot in your childCompleteHandler.

basically, I'm suggesting instead of moving your loaders around into _vidLoadersArray and holder clips after they load, just use your que as the mega reference for all the loaders and let LoaderMax put them in the holders before they load.


if you want an array to loop through all the loaders and not go back to the que, you can set up an array of loaders like:


var allMyLoaders:Array = que.getChildren();


and then later on just do allMyLoaders[someIndex].pauseVideo();





also I should have read this ages ago, maybe it will help you when dealing with parse()


Link to comment
Share on other sites

Hi Carl,

Thanks for your nice example and explenation! It helped me a lot.

The autoDispose property was indeed responsable for the error's i got. So now it's working great.


I tried your pause method, but that deed not seem to work, so i tried your example like this and that worked form me!


var allMyLoaders:Array = _que.getChildren();

for (var i:int = 0; i < allMyLoaders.length; i++) {

var videoLdr:VideoLoader = allMyLoaders as VideoLoader;




Thanks for the reply,




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.