How to access display object parent?

41 views
Skip to first unread message

PTR

unread,
Jun 23, 2015, 9:59:57 AM6/23/15
to haxef...@googlegroups.com
How can I access an FlxSprite's parent container such as an FlxState. I want to remove it from the display list.

Gama11

unread,
Jun 23, 2015, 10:38:31 AM6/23/15
to haxef...@googlegroups.com, zang...@gmail.com
Out of the box, a FlxSprite has no concept of a "parent" (why can be useful in some cases like adding it to several FlxGroups).

If you know that it's been added to the state directly, you can call FlxG.state.remove(this). Other than that, it should be simple enough to create a subclass that you pass the parent FlxGroup to through the constructor.
Reply all
Reply to author
Forward
0 new messages