Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private function kill(childObj:String, parentObj:String = ""):void
- //@param childObj:String - pass the variable name of the child movieclip that you want to be removed and nullified
- //@param parentObj:String = "" - pass the variable name of the parrent if need, to avoid exception errors
- {
- if (this[childObj] != null) // if the movieclip exist...
- {
- if (stage.contains(this[childObj])) // ...and is on stage...
- {
- if (parentObj != "") this[parentObj].removeChild(this[childObj]); // ...if parent mentioned, use parent to remove child from stage.
- else removeChild(this[childObj]); // if has no parent mentioned, just remove child from stage
- }
- this[childObj] = null; // nullify (kill) movieclip
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement