I am building a web site in flash cs3 using frames as pages on my events page i have a xml generated photo gallery that remains onscreen when i navigate through the site i placed removeChild action on the buttons so that when i go to the other pages it will removed the loader but it doesnt work instead it give me this error
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display::DisplayObjectContainer/removeChild()
at navandback_fla::MainTimeline/welcome()
the code that i use to generat e this error is
function welcome(e:Event):void {
gotoAndPlay(“Welcome”);
if (thisLoader!= null) {
removeChild(thisLoader);
}
if (imageLoader!= null) {
removeChild(imageLoader);
}
}
where as the first remove action works on my guestbook app but it does work on the imageLoader if it will help here is the code that gererates the gallery
var imageLoader:Loader;
var xml:XML;
var il:XMLList;
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE,onLoaded);
loader.load(new URLRequest(“new.xml”));
function onLoaded (event:Event):void{
xml = new XML(event.target.data);
var xmlList:XMLList = xml.children();
for(var i:int=0; i < xmlList.length(); i++)
{
imageLoader = new Loader();
imageLoader.load(new URLRequest(xmlList*.attribute("thumb")));
imageLoader.x = 350;
imageLoader.y = i*125 + 325;
imageLoader.name = xmlList*.attribute("source");
addChild(imageLoader);
imageLoader.addEventListener(MouseEvent.CLICK,showPicture);
//trace(xmlList.length())
//trace(imageLoader.parent.name);
}
}
function showPicture (event:Event):void{
imageLoader = new Loader();
imageLoader.load(new URLRequest(event.target.name));
imageLoader.x = 600;
imageLoader.y = 325;
addChild(imageLoader);
}
need help please