tag:robotlegs.tenderapp.com,2009-10-18:/discussions/problems/168-cant-access-the-stage-from-my-viewRobotlegs: Discussion 2018-10-18T16:35:17Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/28406312010-09-06T04:15:14Z2010-09-06T04:15:18ZCan't access the stage from my view <div><p>The <a href="http://livedocs.adobe.com/flex/3/langref/flash/display/DisplayObject.html#stage">"stage" property of a DisplayObject</a> is null until the DisplayObject is added to the display list (the tree of view components of which the stage is the root).</p>
<p>So, if a view class needs to do stuff related to the stage, either don't do that stuff in the constructor and instead do it after the ADDED_TO_STAGE event has fired, or otherwise pass in the necessary data as constructor parameters. In this particular example, it seems that simply passing in two Numbers for the desired width and height should suffice.</p></div>ZackPiercetag:robotlegs.tenderapp.com,2009-10-18:Comment/28406312010-09-06T04:24:15Z2010-09-06T04:24:15ZCan't access the stage from my view <div><p>It has noting to do with stage not being added the first thing that I tried is using the ADDED_TO_STAGE event.</p>
<p>I believe it has something to do with RobotLegs.</p>
<p>I add the numbers as a temporary fix however this isn't a really good solution as it hard codes global values into a class. <br />
</p></div>Almogtag:robotlegs.tenderapp.com,2009-10-18:Comment/28406312010-09-06T04:26:13Z2010-09-06T04:26:13ZCan't access the stage from my view <div><p>never mind I just re tried using the ADDED_TO_STAGE event, I got a different error and thought it was the same as stage error</p></div>Almogtag:robotlegs.tenderapp.com,2009-10-18:Comment/28406312010-09-06T04:45:29Z2010-09-06T04:45:29ZCan't access the stage from my view <div><p>Thanks</p></div>Almog