Hello there!
I’ve made a loop that is creating 9x movieClips that is loading external images
and I have also added eventListeners to those movieClips to make it possible
to change the movieclips image.
My problem is that i can’t access the target of the "first eventListener"
Here is the code to browse for the new image, i want to access the movieclip of
this function in a later eventListener, like this: event.CurrentTarget
file.addEventListener(Event.SELECT, onFileSelected);
function mUp(event:MouseEvent):void{
file.browse(new Array(new FileFilter( "Bild (JPG och JPEG)", "*.jpg;*.jpeg;")));
}
The second eventListener. This function is called when the new image is selected
function onFileSelected(event:Event):void{
file.addEventListener(Event.COMPLETE, loadCompleteHandler);
file.load();
}
The third and last function, this function is called when the image is loaded
and is ready to be used.
function loadCompleteHandler(event:Event):void{
file.removeEventListener(Event.COMPLETE, loadCompleteHandler);
var loader:Loader = new Loader();
loader.loadBytes(event.target.data);
** // Here is the problem!
event.target.addChild(loader)**
}
If if put this code, it will target the second function’s event.
event.target.addChild(loader);
I am searching for a code looking like this to replace the
old image with the new one
event.target.target.addChild(loader);
I hope you understand where the problem is and what i’m searching,
Thanks in advance
Tompa