pranadevil Posted May 24, 2016 Share Posted May 24, 2016 hi there im wondering what happens to a child element when its parent suffered .kill() or .destroy() method? does it also get erased from earth? thanks! Link to comment Share on other sites More sharing options...
Umz Posted May 25, 2016 Share Posted May 25, 2016 To test this: Create a Sprite element and add another as it's child. Then call .kill() on the Sprite parent and you'll find the result. Asking questions is good, but experimenting is always the best way to learn, because you'll remember it long. And Yes, the child element is also killed. Just tested it Link to comment Share on other sites More sharing options...
pranadevil Posted May 25, 2016 Author Share Posted May 25, 2016 6 hours ago, Umz said: To test this: Create a Sprite element and add another as it's child. Then call .kill() on the Sprite parent and you'll find the result. Asking questions is good, but experimenting is always the best way to learn, because you'll remember it long. And Yes, the child element is also killed. Just tested it thanks maybe you r right! tried but didnt work. i created a bitmapdata and added as a child to a sprite. when called .kill() the bitmapdata remains alive. any suggestion? Link to comment Share on other sites More sharing options...
Taggrin Posted May 26, 2016 Share Posted May 26, 2016 20 hours ago, pranadevil said: thanks maybe you r right! tried but didnt work. i created a bitmapdata and added as a child to a sprite. when called .kill() the bitmapdata remains alive. any suggestion? If you add "true" to a destroy or kill function, it will also get rid of the childs. For example: object.destroy(true) Link to comment Share on other sites More sharing options...
Recommended Posts