Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private function kill(childObj:String, parentObj:String = ""):void
  2.         //@param childObj:String - pass the variable name of the child movieclip that you want to be removed and nullified
  3.         //@param parentObj:String = "" - pass the variable name of the parrent if need, to avoid exception errors
  4.         {
  5.             if (this[childObj] != null) // if the movieclip exist...
  6.             {
  7.                 if (stage.contains(this[childObj])) // ...and is on stage...
  8.                 {
  9.                     if (parentObj != "") this[parentObj].removeChild(this[childObj]); // ...if parent mentioned, use parent to remove child from stage.
  10.                     else removeChild(this[childObj]); // if has no parent mentioned, just remove child from stage
  11.                 }
  12.                 this[childObj] = null; // nullify (kill) movieclip
  13.             }
  14.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement