Jarmanje
asked on
What is the correct way to check if a Movieclip exists, then remove it? AS3
Hi there, how would i do this in AS3?
if(movieclip exists) {
remove that mc
}
thanks a lot any any help!
if(movieclip exists) {
remove that mc
}
thanks a lot any any help!
ASKER
haha, go as dot org
This doesnt work for me, returns the below error:
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display::DisplayObje ctContaine r/removeCh ild()
at index_fla::Centre_36/butc_ click()
i want to remove the mc from the same stage that the button mc is placed
thanks for the reply
This doesnt work for me, returns the below error:
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display::DisplayObje
at index_fla::Centre_36/butc_
i want to remove the mc from the same stage that the button mc is placed
thanks for the reply
@CyanBlue Hey Jason!
@Jarmanje:
Where are you putting the code?
It looks like you're putting the code in something called "Centre_36" from a function called "butc_click". If you had your code on the timeline, your error would read something like: "at Untitled_fla::MainTimeline /Untitled_ fla::frame 1()"
If you want the code in the movieclip, use:
parent.removeChild( x );
@Jarmanje:
Where are you putting the code?
It looks like you're putting the code in something called "Centre_36" from a function called "butc_click". If you had your code on the timeline, your error would read something like: "at Untitled_fla::MainTimeline
If you want the code in the movieclip, use:
parent.removeChild( x );
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
hi there! I figured it out with your help. thanks a lot
if(loadmcC.stage) {
removeChild(loadmcC)
}
if(loadmcC.stage) {
removeChild(loadmcC)
}
if (mcInstance)
{
removeChild(mcInstance)
}
CyanBlue