<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: stage access out of DocumentRoot in AS3</title>
	<link>http://www.iheartactionscript.com/stage-access-outside-of-documentroot-in-as3/</link>
	<description>Actionscript Tutorials and Articles for AS3 and AS2 by Rob Gungor.</description>
	<pubDate>Wed, 10 Mar 2010 07:03:34 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3</generator>
		<item>
		<title>By: Cedric</title>
		<link>http://www.iheartactionscript.com/stage-access-outside-of-documentroot-in-as3/#comment-337</link>
		<dc:creator>Cedric</dc:creator>
		<pubDate>Thu, 20 Nov 2008 03:26:27 +0000</pubDate>
		<guid>http://www.iheartactionscript.com/stage-access-outside-of-documentroot-in-as3/#comment-337</guid>
		<description>I tried a lot of thing but I'm getting

Error #1009: Cannot access a property or method of a null object reference.

So flex let me access this stage property but the flash player tell me it's null although I added my Class to the display list...


	import mx.core.Container;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	
	import mx.managers.SystemManager;
	import flash.events.Event;
	
	import mx.core.Application;
	
	public class ResolutionController extends Container
	{
		
		
		public function ResolutionController()
		{
		}
		public function register():void{
//access the stage after having added this class to the display list
			this.stage.addEventListener(Event.RESIZE, onResize);
		}</description>
		<content:encoded><![CDATA[<p>I tried a lot of thing but I&#8217;m getting</p>
<p>Error #1009: Cannot access a property or method of a null object reference.</p>
<p>So flex let me access this stage property but the flash player tell me it&#8217;s null although I added my Class to the display list&#8230;</p>
<p>	import mx.core.Container;<br />
	import flash.display.StageAlign;<br />
	import flash.display.StageScaleMode;</p>
<p>	import mx.managers.SystemManager;<br />
	import flash.events.Event;</p>
<p>	import mx.core.Application;</p>
<p>	public class ResolutionController extends Container<br />
	{</p>
<p>		public function ResolutionController()<br />
		{<br />
		}<br />
		public function register():void{<br />
//access the stage after having added this class to the display list<br />
			this.stage.addEventListener(Event.RESIZE, onResize);<br />
		}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jarred</title>
		<link>http://www.iheartactionscript.com/stage-access-outside-of-documentroot-in-as3/#comment-236</link>
		<dc:creator>Jarred</dc:creator>
		<pubDate>Tue, 14 Oct 2008 10:45:59 +0000</pubDate>
		<guid>http://www.iheartactionscript.com/stage-access-outside-of-documentroot-in-as3/#comment-236</guid>
		<description>Thanks for this, it helped me out.</description>
		<content:encoded><![CDATA[<p>Thanks for this, it helped me out.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave</title>
		<link>http://www.iheartactionscript.com/stage-access-outside-of-documentroot-in-as3/#comment-129</link>
		<dc:creator>Dave</dc:creator>
		<pubDate>Mon, 23 Jun 2008 03:52:28 +0000</pubDate>
		<guid>http://www.iheartactionscript.com/stage-access-outside-of-documentroot-in-as3/#comment-129</guid>
		<description>SRB, I've done exactly what you say, but keep getting "Cannot access a property or method of a null object reference."</description>
		<content:encoded><![CDATA[<p>SRB, I&#8217;ve done exactly what you say, but keep getting &#8220;Cannot access a property or method of a null object reference.&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SRB</title>
		<link>http://www.iheartactionscript.com/stage-access-outside-of-documentroot-in-as3/#comment-114</link>
		<dc:creator>SRB</dc:creator>
		<pubDate>Thu, 08 May 2008 19:30:55 +0000</pubDate>
		<guid>http://www.iheartactionscript.com/stage-access-outside-of-documentroot-in-as3/#comment-114</guid>
		<description>In case it's helpful to anyone:
".stage" is a member of the DisplayObject object.  That means that DisplayObjectContainer, MovieClip, Sprite, etc. all inherit .stage from DisplayObject.

In other words, every sprite and every movieclip and every custom class that extends either of them -- everything that can possibly appear on the stage -- has a .stage property.

That means you can do this:

public class MyClass extends Sprite {
   public function MyClass( ) {
      trace( this.stage.width );
   }
}


Hope it helps.</description>
		<content:encoded><![CDATA[<p>In case it&#8217;s helpful to anyone:<br />
&#8220;.stage&#8221; is a member of the DisplayObject object.  That means that DisplayObjectContainer, MovieClip, Sprite, etc. all inherit .stage from DisplayObject.</p>
<p>In other words, every sprite and every movieclip and every custom class that extends either of them &#8212; everything that can possibly appear on the stage &#8212; has a .stage property.</p>
<p>That means you can do this:</p>
<p>public class MyClass extends Sprite {<br />
   public function MyClass( ) {<br />
      trace( this.stage.width );<br />
   }<br />
}</p>
<p>Hope it helps.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rob Gungor</title>
		<link>http://www.iheartactionscript.com/stage-access-outside-of-documentroot-in-as3/#comment-69</link>
		<dc:creator>Rob Gungor</dc:creator>
		<pubDate>Mon, 07 Jan 2008 03:07:35 +0000</pubDate>
		<guid>http://www.iheartactionscript.com/stage-access-outside-of-documentroot-in-as3/#comment-69</guid>
		<description>JM - addChild is a method of a display object - if you're trying to access the Stage - it would be defined as "stage" in your document root. If you added an object to the stage - you can then add objects to that via addChild. So - stage.addChild(myObject). myObject.addChild(whatever);

Does that help?</description>
		<content:encoded><![CDATA[<p>JM - addChild is a method of a display object - if you&#8217;re trying to access the Stage - it would be defined as &#8220;stage&#8221; in your document root. If you added an object to the stage - you can then add objects to that via addChild. So - stage.addChild(myObject). myObject.addChild(whatever);</p>
<p>Does that help?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JM</title>
		<link>http://www.iheartactionscript.com/stage-access-outside-of-documentroot-in-as3/#comment-68</link>
		<dc:creator>JM</dc:creator>
		<pubDate>Mon, 07 Jan 2008 02:52:05 +0000</pubDate>
		<guid>http://www.iheartactionscript.com/stage-access-outside-of-documentroot-in-as3/#comment-68</guid>
		<description>Still can't figure this out. 
So if I want to addChild from an AS file other than the document class, I would have to do something like:
_stage.addChild(MC); ?</description>
		<content:encoded><![CDATA[<p>Still can&#8217;t figure this out.<br />
So if I want to addChild from an AS file other than the document class, I would have to do something like:<br />
_stage.addChild(MC); ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt</title>
		<link>http://www.iheartactionscript.com/stage-access-outside-of-documentroot-in-as3/#comment-13</link>
		<dc:creator>Matt</dc:creator>
		<pubDate>Fri, 19 Oct 2007 21:58:40 +0000</pubDate>
		<guid>http://www.iheartactionscript.com/stage-access-outside-of-documentroot-in-as3/#comment-13</guid>
		<description>would you care to explain why this new model is a good thing, as you so faithfully pointed out?</description>
		<content:encoded><![CDATA[<p>would you care to explain why this new model is a good thing, as you so faithfully pointed out?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
