<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Stage RESIZE and the stageWidth and stageHeight Bug</title>
	<atom:link href="http://hubflanger.com/stage-resize-and-the-stagewidth-and-stageheight-properties/feed/" rel="self" type="application/rss+xml" />
	<link>http://hubflanger.com/stage-resize-and-the-stagewidth-and-stageheight-properties/</link>
	<description>adventures in code</description>
	<lastBuildDate>Wed, 28 Jul 2010 23:34:41 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: borriej</title>
		<link>http://hubflanger.com/stage-resize-and-the-stagewidth-and-stageheight-properties/comment-page-1/#comment-1144</link>
		<dc:creator>borriej</dc:creator>
		<pubDate>Wed, 28 Jul 2010 23:34:41 +0000</pubDate>
		<guid isPermaLink="false">http://hubflanger.com/using-the-stagewidth-and-stageheight-properties-2/#comment-1144</guid>
		<description>please help me out, I&#039;ve read all of the above, but couldnt find a solution for my flash to be scaled by FireFox at refresh. When I resize the window it will work, but it should resize on a simple F5...

AS 2.0:

new FrameDelay(init);
Stage.align = &quot;TL&quot;;
Stage.scaleMode = &quot;noScale&quot;;
sizeListener = new Object();
sizeListener.onResize = function() {
	trace(Stage.width);
	trace(Stage.height);
	txt_width=Stage.width;
	txt_height=Stage.height;
	trace (width);
	
	onderkant._x = Stage.width - 691;
	Afb_mc._x = Stage.width - 267;
	
	
};
Stage.addListener(sizeListener);
stop();</description>
		<content:encoded><![CDATA[<p>please help me out, I&#8217;ve read all of the above, but couldnt find a solution for my flash to be scaled by FireFox at refresh. When I resize the window it will work, but it should resize on a simple F5&#8230;</p>
<p>AS 2.0:</p>
<p>new FrameDelay(init);<br />
Stage.align = &#8220;TL&#8221;;<br />
Stage.scaleMode = &#8220;noScale&#8221;;<br />
sizeListener = new Object();<br />
sizeListener.onResize = function() {<br />
	trace(Stage.width);<br />
	trace(Stage.height);<br />
	txt_width=Stage.width;<br />
	txt_height=Stage.height;<br />
	trace (width);</p>
<p>	onderkant._x = Stage.width &#8211; 691;<br />
	Afb_mc._x = Stage.width &#8211; 267;</p>
<p>};<br />
Stage.addListener(sizeListener);<br />
stop();</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yahoo Movie News</title>
		<link>http://hubflanger.com/stage-resize-and-the-stagewidth-and-stageheight-properties/comment-page-1/#comment-1136</link>
		<dc:creator>Yahoo Movie News</dc:creator>
		<pubDate>Sat, 12 Jun 2010 08:38:50 +0000</pubDate>
		<guid isPermaLink="false">http://hubflanger.com/using-the-stagewidth-and-stageheight-properties-2/#comment-1136</guid>
		<description>&lt;strong&gt;Yahoo News...&lt;/strong&gt;

This is really great news today....</description>
		<content:encoded><![CDATA[<p><strong>Yahoo News&#8230;</strong></p>
<p>This is really great news today&#8230;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: koi fish</title>
		<link>http://hubflanger.com/stage-resize-and-the-stagewidth-and-stageheight-properties/comment-page-1/#comment-1132</link>
		<dc:creator>koi fish</dc:creator>
		<pubDate>Wed, 02 Jun 2010 01:03:16 +0000</pubDate>
		<guid isPermaLink="false">http://hubflanger.com/using-the-stagewidth-and-stageheight-properties-2/#comment-1132</guid>
		<description>One of the terrific features about blogs is the capability to empower all of us to share many thoughts on the world wide web. Sometimes it&#039;s just amazing to blast away your thoughts and get it out of your head. And you want to know what&#039;s fabulous about it? It doesn&#039;t matter what the subject is! There will always be an interested party to read what you&#039;ve written. Saying by &lt;a href=&quot;http://www.koistop.com/koi.php&quot; rel=&quot;nofollow&quot;&gt;koi&lt;/a&gt;. Thank you for sharing yours.</description>
		<content:encoded><![CDATA[<p>One of the terrific features about blogs is the capability to empower all of us to share many thoughts on the world wide web. Sometimes it&#8217;s just amazing to blast away your thoughts and get it out of your head. And you want to know what&#8217;s fabulous about it? It doesn&#8217;t matter what the subject is! There will always be an interested party to read what you&#8217;ve written. Saying by <a href="http://www.koistop.com/koi.php" rel="nofollow">koi</a>. Thank you for sharing yours.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: RCDMK</title>
		<link>http://hubflanger.com/stage-resize-and-the-stagewidth-and-stageheight-properties/comment-page-1/#comment-997</link>
		<dc:creator>RCDMK</dc:creator>
		<pubDate>Sun, 04 Apr 2010 19:47:07 +0000</pubDate>
		<guid isPermaLink="false">http://hubflanger.com/using-the-stagewidth-and-stageheight-properties-2/#comment-997</guid>
		<description>I was having the same issue. My solution was to use the standard Main class FlashDevelop creates, with the ADDED_TO_STAGE event, that fires a init function:
	public function Main():void 
		{
			if (stage) init();
			else addEventListener(Event.ADDED_TO_STAGE, init);
		}
		
		private function init(e:Event = null):void 
		{
			removeEventListener(Event.ADDED_TO_STAGE, init);
			// entry point
			
			stage.scaleMode = StageScaleMode.EXACT_FIT;
			var grafico:Grafico = new Grafico();
			
			grafico.Desenhar();
			grafico.x = (stage.stageWidth - grafico.width) / 2;
			grafico.y = (stage.stageHeight - grafico.height) / 2;
			
			addChild(grafico);
}

Hope that it heps.</description>
		<content:encoded><![CDATA[<p>I was having the same issue. My solution was to use the standard Main class FlashDevelop creates, with the ADDED_TO_STAGE event, that fires a init function:<br />
	public function Main():void<br />
		{<br />
			if (stage) init();<br />
			else addEventListener(Event.ADDED_TO_STAGE, init);<br />
		}</p>
<p>		private function init(e:Event = null):void<br />
		{<br />
			removeEventListener(Event.ADDED_TO_STAGE, init);<br />
			// entry point</p>
<p>			stage.scaleMode = StageScaleMode.EXACT_FIT;<br />
			var grafico:Grafico = new Grafico();</p>
<p>			grafico.Desenhar();<br />
			grafico.x = (stage.stageWidth &#8211; grafico.width) / 2;<br />
			grafico.y = (stage.stageHeight &#8211; grafico.height) / 2;</p>
<p>			addChild(grafico);<br />
}</p>
<p>Hope that it heps.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: NS</title>
		<link>http://hubflanger.com/stage-resize-and-the-stagewidth-and-stageheight-properties/comment-page-1/#comment-752</link>
		<dc:creator>NS</dc:creator>
		<pubDate>Fri, 11 Sep 2009 21:41:10 +0000</pubDate>
		<guid isPermaLink="false">http://hubflanger.com/using-the-stagewidth-and-stageheight-properties-2/#comment-752</guid>
		<description>I am having the same problem as Randall mentioned. My flex app do not load in Google Chrome ; if I resize the window, it loads up fine.</description>
		<content:encoded><![CDATA[<p>I am having the same problem as Randall mentioned. My flex app do not load in Google Chrome ; if I resize the window, it loads up fine.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stage.stageWidth and stage.stageHeight bugs in certain browsers &#171; Jufa</title>
		<link>http://hubflanger.com/stage-resize-and-the-stagewidth-and-stageheight-properties/comment-page-1/#comment-750</link>
		<dc:creator>Stage.stageWidth and stage.stageHeight bugs in certain browsers &#171; Jufa</dc:creator>
		<pubDate>Wed, 09 Sep 2009 19:55:32 +0000</pubDate>
		<guid isPermaLink="false">http://hubflanger.com/using-the-stagewidth-and-stageheight-properties-2/#comment-750</guid>
		<description>[...] http://hubflanger.com/stage-resize-and-the-stagewidth-and-stageheight-properties/     &#171; FITC&#160;Edmonton [...]</description>
		<content:encoded><![CDATA[<p>[...] <a href="http://hubflanger.com/stage-resize-and-the-stagewidth-and-stageheight-properties/" rel="nofollow">http://hubflanger.com/stage-resize-and-the-stagewidth-and-stageheight-properties/</a>     &laquo; FITC&nbsp;Edmonton [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Randall</title>
		<link>http://hubflanger.com/stage-resize-and-the-stagewidth-and-stageheight-properties/comment-page-1/#comment-633</link>
		<dc:creator>Randall</dc:creator>
		<pubDate>Tue, 12 May 2009 21:20:45 +0000</pubDate>
		<guid isPermaLink="false">http://hubflanger.com/using-the-stagewidth-and-stageheight-properties-2/#comment-633</guid>
		<description>Try your demo in Google Chrome.  Grabbing the bottom of the window and resizing vertically does not trigger the RESIZE event.  Horizontal resize works as expected.  Also the same case in Safari for Mac/OSX although tougher to replicate since you can only resize with the corner of the window.  Looks like a problem with WebKit. Very frustrating.</description>
		<content:encoded><![CDATA[<p>Try your demo in Google Chrome.  Grabbing the bottom of the window and resizing vertically does not trigger the RESIZE event.  Horizontal resize works as expected.  Also the same case in Safari for Mac/OSX although tougher to replicate since you can only resize with the corner of the window.  Looks like a problem with WebKit. Very frustrating.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Will</title>
		<link>http://hubflanger.com/stage-resize-and-the-stagewidth-and-stageheight-properties/comment-page-1/#comment-612</link>
		<dc:creator>Will</dc:creator>
		<pubDate>Fri, 27 Mar 2009 19:51:32 +0000</pubDate>
		<guid isPermaLink="false">http://hubflanger.com/using-the-stagewidth-and-stageheight-properties-2/#comment-612</guid>
		<description>Great! I was pulling my hair out trying to figure out why this was happening. The following code seems to work for me without the need to mess around with timers, frame events etc. The following would go in a document class called Main.

public function Main():void {
   stage.align = StageAlign.TOP_LEFT;
   stage.scaleMode = StageScaleMode.NO_SCALE;		
   this.loaderInfo.addEventListener(Event.COMPLETE, init);		
}
private function init(e:Event):void {
    if (stage.stageWidth == 0 &#124;&#124; stage.stageHeight == 0) {
        stage.addEventListener(Event.RESIZE, init);
    } else {
	// Init stuff goes here!			
    }
}</description>
		<content:encoded><![CDATA[<p>Great! I was pulling my hair out trying to figure out why this was happening. The following code seems to work for me without the need to mess around with timers, frame events etc. The following would go in a document class called Main.</p>
<p>public function Main():void {<br />
   stage.align = StageAlign.TOP_LEFT;<br />
   stage.scaleMode = StageScaleMode.NO_SCALE;<br />
   this.loaderInfo.addEventListener(Event.COMPLETE, init);<br />
}<br />
private function init(e:Event):void {<br />
    if (stage.stageWidth == 0 || stage.stageHeight == 0) {<br />
        stage.addEventListener(Event.RESIZE, init);<br />
    } else {<br />
	// Init stuff goes here!<br />
    }<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: StorUrsa</title>
		<link>http://hubflanger.com/stage-resize-and-the-stagewidth-and-stageheight-properties/comment-page-1/#comment-609</link>
		<dc:creator>StorUrsa</dc:creator>
		<pubDate>Fri, 20 Mar 2009 21:41:12 +0000</pubDate>
		<guid isPermaLink="false">http://hubflanger.com/using-the-stagewidth-and-stageheight-properties-2/#comment-609</guid>
		<description>I see this as a bug only if the Demo is serving as the document class.

If it&#039;s not serving and the document class then I assume this is the code you are using:
var d:Demo = new Demo(); &lt;-- at this point the DisplayObject doesn&#039;t get a reference to stage
addChild(d); &lt;-- at this point the DisplayObject does have a reference to stage.

The stage reference gets set on DisplayObjects once they are added to the stage.

I get why they did this, and DisplayObject shouldn&#039;t know anything about the stageWidth or stageHeight, before it is added to a certain stage.  Just as the DisplayObject doesn&#039;t have a parent before it is added to the Display List.

But I also understand why you expect stage to be defined, because for all intents and purposes the stage object is a global variable and should be accessible by any subclass of DisplayObject. Problem is when do you set the stage reference. In the DisplayObject constructor, of course.... Wait... The DisplayObject is an abstract class and a call the the constructor throws an ArgumentError.

So the only logical place to set it is when a DisplayObject is added to the stage.</description>
		<content:encoded><![CDATA[<p>I see this as a bug only if the Demo is serving as the document class.</p>
<p>If it&#8217;s not serving and the document class then I assume this is the code you are using:<br />
var d:Demo = new Demo(); &lt;&#8211; at this point the DisplayObject doesn&#8217;t get a reference to stage<br />
addChild(d); &lt;&#8211; at this point the DisplayObject does have a reference to stage.</p>
<p>The stage reference gets set on DisplayObjects once they are added to the stage.</p>
<p>I get why they did this, and DisplayObject shouldn&#8217;t know anything about the stageWidth or stageHeight, before it is added to a certain stage.  Just as the DisplayObject doesn&#8217;t have a parent before it is added to the Display List.</p>
<p>But I also understand why you expect stage to be defined, because for all intents and purposes the stage object is a global variable and should be accessible by any subclass of DisplayObject. Problem is when do you set the stage reference. In the DisplayObject constructor, of course&#8230;. Wait&#8230; The DisplayObject is an abstract class and a call the the constructor throws an ArgumentError.</p>
<p>So the only logical place to set it is when a DisplayObject is added to the stage.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Issues happening when event listener on stage added occurs. &#171; Juan develops in AS 3.0</title>
		<link>http://hubflanger.com/stage-resize-and-the-stagewidth-and-stageheight-properties/comment-page-1/#comment-583</link>
		<dc:creator>Issues happening when event listener on stage added occurs. &#171; Juan develops in AS 3.0</dc:creator>
		<pubDate>Mon, 16 Mar 2009 20:19:44 +0000</pubDate>
		<guid isPermaLink="false">http://hubflanger.com/using-the-stagewidth-and-stageheight-properties-2/#comment-583</guid>
		<description>[...] in IE for windows having swf being non-scale, and being embedded using swfobject.  In this site: http://hubflanger.com/stage-resize-and-the-stagewidth-and-stageheight-properties. They mentioned that the stage dimensions can be returned as 0.  they recommend to target instead [...]</description>
		<content:encoded><![CDATA[<p>[...] in IE for windows having swf being non-scale, and being embedded using swfobject.  In this site: <a href="http://hubflanger.com/stage-resize-and-the-stagewidth-and-stageheight-properties" rel="nofollow">http://hubflanger.com/stage-resize-and-the-stagewidth-and-stageheight-properties</a>. They mentioned that the stage dimensions can be returned as 0.  they recommend to target instead [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
