Skip to main content
Inspiring
June 1, 2011
Answered

loadClip() with onLoadError()

  • June 1, 2011
  • 1 reply
  • 507 views

In my application using loadClip() to load the multiple images and i am also using the onLoadError(). i have attached a movieclip inside of onLoadError(). so, whenever the loadClip() fails it will call the onLoadError() .But if multiple images loaded fails, the same number of time onLoadError() is called .so multiple movieclip is attached.My requirement is , once  if i get a onLoadError() the process of loadClip() should stop.

Ex:

for(var i=0;i<my_array.length;i++)

{

        mc =_root.createEmptyMovieClip("mc"+i,_root.getNextHighestDepth());

        mcLoader.loadClip(my_array,mc);

}

objListener.onLoadError = function(Mc:MovieClip)

{

    _root.attachMovie("alert_mc","msgMc",_root.getNextHighestDepth());

}

can any one help me...

This topic has been closed for replies.
Correct answer kglad
var i:Number=0;
loadF();

function loadF(){

mc =_root.createEmptyMovieClip("mc"+i,_root.getNextHighestDepth());

mcLoader.loadClip(my_array,mc);

}

objListener.onLoadInit=function(..):Void{

i++;

if(i<my_array.length){

loadF();

} else {

// loading completed without error.

}

}

objListener.onLoadError = function(Mc:MovieClip)

{

    _root.attachMovie("alert_mc","msgMc",_root.getNextHighestDepth());

}

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
June 1, 2011
var i:Number=0;
loadF();

function loadF(){

mc =_root.createEmptyMovieClip("mc"+i,_root.getNextHighestDepth());

mcLoader.loadClip(my_array,mc);

}

objListener.onLoadInit=function(..):Void{

i++;

if(i<my_array.length){

loadF();

} else {

// loading completed without error.

}

}

objListener.onLoadError = function(Mc:MovieClip)

{

    _root.attachMovie("alert_mc","msgMc",_root.getNextHighestDepth());

}

Inspiring
June 3, 2011

Thanks kglad this solution is helpful to my application.

kglad
Community Expert
Community Expert
June 3, 2011

you're welcome.