Can I use an instance of this class to load images in a similar way to placing a Loader component on stage and setting its contentPath?
I want to place an instance of Loader inside a sublcass of MovieClip and then create a method in that class that gets called when I want to load a picture into an instance of the subclass…
This code is in the subclass and _imageLoader is an instance of mx.controls.loader:
function loadImage(path:String){
trace("Loading: " + path);
_imageLoader.contentPath = path;
}
Then in the actions I use in the .fla file I can use the following:
function addImages(){
for(var i:Number = 0; i < tiles.length; i++){
if(i < 10){
var imagePath:String = "images//1_0" + i + ".jpg";
tiles*.loadImage(imagePath);
}
else{
var imagePath:String = "images//1_" + i + ".jpg";
tiles*.loadImage(imagePath);
}
}
}
to load an image… will that work? Obviously it currently does not… but does my approach sound correct? Can the Loader class be used to accomplish this goal?
Cheers.