Hello!
So I think I might be going crazy here, i am hoping someone can shed some light!
I am trying to build a function to load a clip passing a target clip as well as an image or swf to a MovieClipLoader that in turn attaches a preloader to display progress. The function looks like so:
function preloadImage(image:String, targeted:MovieClip){
var imgLoader:MovieClipLoader = new MovieClipLoader();
var mclImage:Object = new Object();
mclImage.onLoadInit = function(targeted:MovieClip){
var plu:MovieClip = targeted.attachMovie("preLoad","preLoad2",10);
// the following iis tracing undefined
trace(plu);
}
mclImage.onLoadProgress = function(targeted:MovieClip, bytesLoaded:Number, bytesTotal:Number) {
//the following is tracing just fine :?
trace(targeted + ".onLoadProgress with " + bytesLoaded + " bytes of " + bytesTotal);
plu._width = Stage.width*(bytesLoaded/bytesTotal);
}
mclImage.onLoadComplete = function() {
trace("hooray! you did it!");
}
mclImage.onLoadError = function(){
trace("something is rotten");
};
imgLoader.addListener(mclImage);
imgLoader.loadClip(image, targeted);
}
var temp:MovieClip = this.createEmptyMovieClip("temp", 100);
preloadImage("images/details/profile2.jpg", temp);
So the image is loading just fine and the progress traces as it should, but the preloader bar that i am trying to attach after onLoadInit is not coming through. Does this have something to do with how I am passing the variables or is this just something I am not going to be able to do for some reason? Please, help me understand, it’s killing me!
Thanks in advance,
ktz