I’m working on OpenFL application and ran into a trouble. I need to create tilemaps dynamically and I created additional class for this functionality (the class extends Sprite class, but main class - not).
Unfortunately I found out that calling addChild() from a method of the additional class does nothing! Tilemaps are not added and I can’ see them. Could you please help me and explain how to use addChild method from another class?
I also tried following:
- Additional class doesn’t extend Sprite, main class extends Sprite. Send lambda with addChild() from main to additional class. Invoke this labda when I need to add tilemap from additional class. Nothing happened - tilemap is not showed.
- Additional class doesn’t extend Sprite, main class extends Sprite. Cast ‘this’ reference to DisplayObjectContainer and send from main class to additional class. Then call casted_this_from_main_class.addChild(). Nothing happened - tilemap is not showed.
With Google I found only old solution with using of reference to stage. It didn’t help me.