For the scenario lets consider Car to be the highest SWF(stage) inside I load tyres. Inside tires I have rims. Now if the rims need to be positioned relative to the stage (car body) how can I do that? Inside rims if I write stage and load it results in an error.
Any Ideas?
in the constructor for rims, first test to see if it’s been added to stage:
public function Rims() { if (stage) init(); else addEventListener(Event.ADDED_TO_STAGE, init); } public function init(e:Event = null) : void { removeEventListener(Event.ADDED_TO_STAGE, init); //you can access stage now. }