|
-
[RESOLVED] Remove Child = remove my brain
Hi,
I cannot get the removeChild method to work.
Any help would great as I have look on here and seen a lot posts but I still cant seem to get it to work. my code:
var timerLoad:Timer = new Timer(2011,1);
timerLoad.addEventListener(TimerEvent.TIMER, onTimerLoad);
timerLoad.start();
function onTimerLoad(evt:TimerEvent):void {
var loaded_clip1:Loader = new Loader();
stage.addChild(loaded_clip1);
loaded_clip1.contentLoaderInfo.addEventListener( Event.INIT, handleInit);
loaded_clip1.load( new URLRequest( "My_file.swf" ) );
function handleInit(evt:Event):void {
var extMovie:* = loaded_clip1.content;
}
//Nav mouse Downs///
purpleNav_Mc.addEventListener(MouseEvent.MOUSE_DOW N, purpleMouseDown);
function purpleMouseDown(e:MouseEvent):void {
stage.removeChild(loaded_clip1);
}
I just get a 1120 error??
Thanks
-
you have loaded_clip1 as a local variable ("var" inside a function), so it doesn't exist outside that function. declare it outside the function and define it inside - like so:
PHP Code:
var loaded_clip1:Loader;
var timerLoad:Timer = new Timer(2011,1); timerLoad.addEventListener(TimerEvent.TIMER, onTimerLoad); timerLoad.start();
function onTimerLoad(evt:TimerEvent):void {
loaded_clip1 = new Loader(); stage.addChild(loaded_clip1);
loaded_clip1.contentLoaderInfo.addEventListener( Event.INIT, handleInit); loaded_clip1.load( new URLRequest( "My_file.swf" ) );
function handleInit(evt:Event):void { var extMovie:* = loaded_clip1.content;
}
//Nav mouse Downs/// purpleNav_Mc.addEventListener(MouseEvent.MOUSE_DOW N, purpleMouseDown);
function purpleMouseDown(e:MouseEvent):void { stage.removeChild(loaded_clip1);
}
-
Ah I see what you mean...brilliant.
Thanks for your help..this one was driving me nuts!!!
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|