View Full Version : problem with unloading images.
_dfm_
August 2nd, 2007, 10:45 AM
Hi, in short I can load image in MC. But when I try to unload, happened problem. Image stay there. Why I'm mistaken?
Here is my AS
import flash.display.Loader;
....
var bigOne_loader:Loader = new Loader();
show_btn.addEventListener(MouseEvent.MOUSE_DOWN, showMeBigOne);
....
function showMeBigOne(info:MouseEvent):void {
bigOne_loader.unload();
......
}
....
bigOne_loader.contentLoaderInfo.addEventListener(E vent.COMPLETE, showPic_complite);
bigOne_loader.load(new URLRequest("gallery/blah_blah.jpg"));
....
geoken
August 2nd, 2007, 11:25 AM
what happens if you change the code inside the function that listens to the button press to;
removeChild(bigOne_loader)?
Can you post the function "showPic_complite"?
_dfm_
August 2nd, 2007, 12:10 PM
get an error:
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display::DisplayObjectContainer/removeChild()
at classes.attachClasses::thumbs/hideFadedPictdeure()
function showPic_complite(info:Event):void {
parent.parent["bigOne_mc"].conteiner_mc.alpha =0;
parent.parent["bigOne_mc"].conteiner_mc.addChild(bigOne_loader);
parent.parent["bigOne_mc"].conteiner_mc.addEventListener(Event.ENTER_FRAME, showFadedPicture);
}
any ideas?
geoken
August 2nd, 2007, 12:19 PM
any ideas?
Yeah, simply use removeChild in the exact same method, with the exact same path as addChild.
This is were you added the pic;
parent.parent["bigOne_mc"].conteiner_mc.addChild(bigOne_loader);
you would need to point to the exact same object when you're removing the pic;
parent.parent["bigOne_mc"].conteiner_mc.removeChild(bigOne_loader);
_dfm_
August 2nd, 2007, 03:32 PM
dont work.
parent.parent["bigOne_mc"].conteiner_mc.removeChild(bigOne_loader);
an error 2025 occure.
geoken
August 2nd, 2007, 05:57 PM
dont work.
parent.parent["bigOne_mc"].conteiner_mc.removeChild(bigOne_loader);
an error 2025 occure.
Sorry, I should have been more clear. The code I typed was just an example. I haven't seen all your code so I don't know how all your cips are nested and where your functions are bieng called from. My point was that you need to point removeChild() at whatever clip you added the pic to.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.