

































<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.0.2" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: How to Position Movie Clips Based on Browser Resizing</title>
	<link>http://www.quip.net/blog/2006/flash/how-to-position-movie-clips-browser-resizing</link>
	<description>Luck is the residue of good design.</description>
	<pubDate>Wed, 08 Feb 2012 15:11:32 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.2</generator>

	<item>
		<title>by: stephan</title>
		<link>http://www.quip.net/blog/2006/flash/how-to-position-movie-clips-browser-resizing#comment-450203</link>
		<pubDate>Sun, 11 Apr 2010 04:54:32 +0000</pubDate>
		<guid>http://www.quip.net/blog/2006/flash/how-to-position-movie-clips-browser-resizing#comment-450203</guid>
					<description>hello dave

this is my question please

I have used code below to position a mc inside my main mc and it works when i for example resizes the browser window the mc stays in the same position and in view no matter browser size.

i wana do the same function this time with an externally loaded mc
thanks bro

stephan

Stage.scaleMode = &quot;noScale&quot;;
Stage.align = &quot;TL&quot;;
var stageListener:Object = new Object ();
stageListener.onResize = positionContent;
Stage.addListener(stageListener);

function positionContent():Void {
   mcLogo._x = Stage.width - mcLogo._width;
   mcLogo._y = Stage.height - mcLogo._height;
}
positionContent();</description>
		<content:encoded><![CDATA[<p>hello dave</p>
<p>this is my question please</p>
<p>I have used code below to position a mc inside my main mc and it works when i for example resizes the browser window the mc stays in the same position and in view no matter browser size.</p>
<p>i wana do the same function this time with an externally loaded mc<br />
thanks bro</p>
<p>stephan</p>
<p>Stage.scaleMode = &#8220;noScale&#8221;;<br />
Stage.align = &#8220;TL&#8221;;<br />
var stageListener:Object = new Object ();<br />
stageListener.onResize = positionContent;<br />
Stage.addListener(stageListener);</p>
<p>function positionContent():Void {<br />
   mcLogo._x = Stage.width - mcLogo._width;<br />
   mcLogo._y = Stage.height - mcLogo._height;<br />
}<br />
positionContent();
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: nkahfai</title>
		<link>http://www.quip.net/blog/2006/flash/how-to-position-movie-clips-browser-resizing#comment-352626</link>
		<pubDate>Thu, 19 Feb 2009 13:47:38 +0000</pubDate>
		<guid>http://www.quip.net/blog/2006/flash/how-to-position-movie-clips-browser-resizing#comment-352626</guid>
					<description>Hi David,

I have couple question for full screen flash site, how to separate few categorize full flash with html?

example link http://www.mariafilo.com.br/#/negocios/

there will always have # in the url and wont affect the full screen script.
how to do that ?

Thanks so much.
kahfai</description>
		<content:encoded><![CDATA[<p>Hi David,</p>
<p>I have couple question for full screen flash site, how to separate few categorize full flash with html?</p>
<p>example link <a href='http://www.mariafilo.com.br/#/negocios/' rel='nofollow'>http://www.mariafilo.com.br/#/negocios/</a></p>
<p>there will always have # in the url and wont affect the full screen script.<br />
how to do that ?</p>
<p>Thanks so much.<br />
kahfai
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Flug Australien</title>
		<link>http://www.quip.net/blog/2006/flash/how-to-position-movie-clips-browser-resizing#comment-352241</link>
		<pubDate>Wed, 18 Feb 2009 17:00:34 +0000</pubDate>
		<guid>http://www.quip.net/blog/2006/flash/how-to-position-movie-clips-browser-resizing#comment-352241</guid>
					<description>Thank u very much for taking the time to write this article which is very helpful for me.
I'm a HTML ; PHP beginner and have the problem that I didn't suceeded to embed a flash video to my html Website. I have used the this sample code

:(
Can u plz help me to fix the problem, I would be very thankful.
Then I can try To position movie clips based on browser resizing.</description>
		<content:encoded><![CDATA[<p>Thank u very much for taking the time to write this article which is very helpful for me.<br />
I&#8217;m a HTML ; PHP beginner and have the problem that I didn&#8217;t suceeded to embed a flash video to my html Website. I have used the this sample code</p>
<p>:(<br />
Can u plz help me to fix the problem, I would be very thankful.<br />
Then I can try To position movie clips based on browser resizing.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: kahfai</title>
		<link>http://www.quip.net/blog/2006/flash/how-to-position-movie-clips-browser-resizing#comment-302824</link>
		<pubDate>Thu, 20 Nov 2008 02:14:27 +0000</pubDate>
		<guid>http://www.quip.net/blog/2006/flash/how-to-position-movie-clips-browser-resizing#comment-302824</guid>
					<description>I realize that the MovieClip do not move to the position from the beginning, it stay still in the position on working fla. Than it will only move while resize the browser . 

what happen?

hope you can help me ..TQ</description>
		<content:encoded><![CDATA[<p>I realize that the MovieClip do not move to the position from the beginning, it stay still in the position on working fla. Than it will only move while resize the browser . </p>
<p>what happen?</p>
<p>hope you can help me ..TQ
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: kahfai</title>
		<link>http://www.quip.net/blog/2006/flash/how-to-position-movie-clips-browser-resizing#comment-301733</link>
		<pubDate>Wed, 19 Nov 2008 03:50:43 +0000</pubDate>
		<guid>http://www.quip.net/blog/2006/flash/how-to-position-movie-clips-browser-resizing#comment-301733</guid>
					<description>Hi David !

I'm facing some strange problem...
I'm working on a website that's fit on browser size, every thing is work fine in swf, but using browser to preview, the content is not in the actual position until i resize the browser..why ? 

Below is the link, i haven't done the loading yet, have to wait for a while :-P
http://www.soulproject.com.my/summit/

how to pop up a light box kinda effect when user's resize the browser smaller then 800x600 px ?

Hope you can help me on it, thanks !

kahfai</description>
		<content:encoded><![CDATA[<p>Hi David !</p>
<p>I&#8217;m facing some strange problem&#8230;<br />
I&#8217;m working on a website that&#8217;s fit on browser size, every thing is work fine in swf, but using browser to preview, the content is not in the actual position until i resize the browser..why ? </p>
<p>Below is the link, i haven&#8217;t done the loading yet, have to wait for a while <img src='http://www.quip.net/blog/wp-includes/images/smilies/icon_razz.gif' alt=':-P' class='wp-smiley' /><br />
<a href='http://www.soulproject.com.my/summit/' rel='nofollow'>http://www.soulproject.com.my/summit/</a></p>
<p>how to pop up a light box kinda effect when user&#8217;s resize the browser smaller then 800&#215;600 px ?</p>
<p>Hope you can help me on it, thanks !</p>
<p>kahfai
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: otavio</title>
		<link>http://www.quip.net/blog/2006/flash/how-to-position-movie-clips-browser-resizing#comment-288416</link>
		<pubDate>Wed, 15 Oct 2008 22:27:02 +0000</pubDate>
		<guid>http://www.quip.net/blog/2006/flash/how-to-position-movie-clips-browser-resizing#comment-288416</guid>
					<description>Hi David! 
I also wish to thank you for the time you are dedicating to help people out. All of those comments helped me doing a lot of things!

I have 2 questions that I think that wasn't already questioned here.

I have as an example this site:
http://www.stevenkleinstudio.com/www/index.html

As you can see it uses the same things that you taught.
But! It has a menu that has a scroll bar that dynamically resizes when you resize the browser...
I tried doing a lot of different things without success.
Another thing that you could help me is about the image resizing... I could only do it horizontally (that site resizes the image when you resize your browser vertically too) how can I do this?

Thanks in advance! ;)
Otávio.</description>
		<content:encoded><![CDATA[<p>Hi David!<br />
I also wish to thank you for the time you are dedicating to help people out. All of those comments helped me doing a lot of things!</p>
<p>I have 2 questions that I think that wasn&#8217;t already questioned here.</p>
<p>I have as an example this site:<br />
<a href='http://www.stevenkleinstudio.com/www/index.html' rel='nofollow'>http://www.stevenkleinstudio.com/www/index.html</a></p>
<p>As you can see it uses the same things that you taught.<br />
But! It has a menu that has a scroll bar that dynamically resizes when you resize the browser&#8230;<br />
I tried doing a lot of different things without success.<br />
Another thing that you could help me is about the image resizing&#8230; I could only do it horizontally (that site resizes the image when you resize your browser vertically too) how can I do this?</p>
<p>Thanks in advance! <img src='http://www.quip.net/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
Otávio.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Matt</title>
		<link>http://www.quip.net/blog/2006/flash/how-to-position-movie-clips-browser-resizing#comment-285772</link>
		<pubDate>Mon, 06 Oct 2008 21:11:09 +0000</pubDate>
		<guid>http://www.quip.net/blog/2006/flash/how-to-position-movie-clips-browser-resizing#comment-285772</guid>
					<description>Hi David,

Im having heaps of trouble with my slider.

Is it possible to email you the documents to see how I should incorporate the code?

Thanks so much.

Matt</description>
		<content:encoded><![CDATA[<p>Hi David,</p>
<p>Im having heaps of trouble with my slider.</p>
<p>Is it possible to email you the documents to see how I should incorporate the code?</p>
<p>Thanks so much.</p>
<p>Matt
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: David Stiller</title>
		<link>http://www.quip.net/blog/2006/flash/how-to-position-movie-clips-browser-resizing#comment-282796</link>
		<pubDate>Thu, 02 Oct 2008 01:50:46 +0000</pubDate>
		<guid>http://www.quip.net/blog/2006/flash/how-to-position-movie-clips-browser-resizing#comment-282796</guid>
					<description>&lt;strong&gt;To Matt ...&lt;/strong&gt;

&lt;blockquote&gt;how can i move the mcNav from a button that is placed in another movie clip named &quot;navRight&quot;?&lt;/blockquote&gt;

You bet.  Assuming the button's instance name is &lt;code&gt;myButton&lt;/code&gt; (but use whatever instance name you like), and assuming &lt;code&gt;navRight&lt;/code&gt; is the instance name of that other movie clip, then all you have to do is path to that button in order to handle its &lt;code&gt;onRelease&lt;/code&gt; (or similar) event.

Instead of this:

&lt;pre&gt;&lt;code&gt;mcLogo.onRelease = toggleNav;&lt;/code&gt;&lt;/pre&gt;

... which is what I showed before, you could route that event handler like this:

&lt;pre&gt;&lt;code&gt;navRight.myButton.onRelease = toggleNav;&lt;/code&gt;&lt;/pre&gt;

... and the toggleNav() function wouldn't change.

&lt;blockquote&gt;I would also like to have a button placed inside &quot;mcNav&quot; which moves the clip to out of sight aswell.&lt;/blockquote&gt;

In the same way, you would path to mcNav, by way of its instance name, then to the instance name of the button inside it.  Assuming myButton, which could just as easily be the instance name of that second button:

&lt;pre&gt;&lt;code&gt;mcNav.myButton.onRelease = toggleNav;&lt;/code&gt;&lt;/pre&gt;

Both buttons can have the same instance name, because they're both nested inside movie clips with distinct instance names.  And both buttons can be assigned to the same event handler function.

&lt;strong&gt;To Cris ...&lt;/strong&gt;

I remember that reply, oddly enough.  (Gosh, that was quite a while ago!)  That sample code was written by M. A. Turner, actually, and looking at it now, I see quite a few errors with it &amp;#8212; I'm guessing M. A. noticed that too and (I hope) fixed it.

The references to &lt;code&gt;_global._focusrect&lt;/code&gt; and &lt;code&gt;_global._quality&lt;/code&gt;, for example, don't really do anything.  Those properties are members of the &lt;code&gt;MovieClip&lt;/code&gt; class, and the &lt;code&gt;_global&lt;/code&gt; object doesn't point to a movie clip, so if those really were necessary to M. A.'s needs &amp;#8212; and I'm assuming they were &amp;#8212; they should have been routed to the timeline in which the code was written (assuming it was written in the main timeline), which means &lt;code&gt;_global&lt;/code&gt; should have been replaced with &lt;code&gt;this&lt;/code&gt;, or omitted entirely.

The meat of the matter is M. A.'s approach to maintaining aspect ratio, which (rightly or wrongly) I never did test.

If you want want your images to scale to the browser and never crop, it means you will inevitably see letterboxing or pillarboxing when the browser's aspect ratio isn't the same aspect ratio of the image.  There's no way around that, and I hope it makes sense to you why.  Assuming you're okay with that, here's a quick suggestion that will scale the image without cropping:

&lt;pre&gt;&lt;code&gt;Stage.scaleMode = &amp;#34;noScale&amp;#34;;
Stage.align = &amp;#34;TL&amp;#34;;
var stageListener:Object = new Object ();
stageListener.onResize = positionContent;
Stage.addListener(stageListener);

function positionContent():Void {
  photo._width = Stage.width;
  photo._yscale = photo._xscale;
  if (photo._height &gt; Stage.height) {
    photo._height = Stage.height;
    photo._xscale = photo._yscale;
  }
  photo._x = Stage.width / 2 - photo._width / 2;
  photo._y = Stage.height / 2 - photo._height / 2;
}
positionContent();&lt;/code&gt;&lt;/pre&gt;

The basic mechanics are very similar to my original code prior to any of the comments.  In this revision, the width of the photo is set to the width of the Stage.  The height (via &lt;code&gt;_yscale&lt;/code&gt;) is adjusted by the same value as the width.  Then an &lt;code&gt;if&lt;/code&gt; statement checks to see if the photo is now taller than the Stage.  If so, the same manipulation is performed in reverse.  After that, the image is centered (assuming an upper left registration point on the &lt;code&gt;photo&lt;/code&gt; movie clip).  This means the image will never be cropped.</description>
		<content:encoded><![CDATA[<p><strong>To Matt &#8230;</strong></p>
<blockquote><p>how can i move the mcNav from a button that is placed in another movie clip named &#8220;navRight&#8221;?</p></blockquote>
<p>You bet.  Assuming the button&#8217;s instance name is <code>myButton</code> (but use whatever instance name you like), and assuming <code>navRight</code> is the instance name of that other movie clip, then all you have to do is path to that button in order to handle its <code>onRelease</code> (or similar) event.</p>
<p>Instead of this:</p>
<pre><code>mcLogo.onRelease = toggleNav;</code></pre>
<p>&#8230; which is what I showed before, you could route that event handler like this:</p>
<pre><code>navRight.myButton.onRelease = toggleNav;</code></pre>
<p>&#8230; and the toggleNav() function wouldn&#8217;t change.</p>
<blockquote><p>I would also like to have a button placed inside &#8220;mcNav&#8221; which moves the clip to out of sight aswell.</p></blockquote>
<p>In the same way, you would path to mcNav, by way of its instance name, then to the instance name of the button inside it.  Assuming myButton, which could just as easily be the instance name of that second button:</p>
<pre><code>mcNav.myButton.onRelease = toggleNav;</code></pre>
<p>Both buttons can have the same instance name, because they&#8217;re both nested inside movie clips with distinct instance names.  And both buttons can be assigned to the same event handler function.</p>
<p><strong>To Cris &#8230;</strong></p>
<p>I remember that reply, oddly enough.  (Gosh, that was quite a while ago!)  That sample code was written by M. A. Turner, actually, and looking at it now, I see quite a few errors with it &mdash; I&#8217;m guessing M. A. noticed that too and (I hope) fixed it.</p>
<p>The references to <code>_global._focusrect</code> and <code>_global._quality</code>, for example, don&#8217;t really do anything.  Those properties are members of the <code>MovieClip</code> class, and the <code>_global</code> object doesn&#8217;t point to a movie clip, so if those really were necessary to M. A.&#8217;s needs &mdash; and I&#8217;m assuming they were &mdash; they should have been routed to the timeline in which the code was written (assuming it was written in the main timeline), which means <code>_global</code> should have been replaced with <code>this</code>, or omitted entirely.</p>
<p>The meat of the matter is M. A.&#8217;s approach to maintaining aspect ratio, which (rightly or wrongly) I never did test.</p>
<p>If you want want your images to scale to the browser and never crop, it means you will inevitably see letterboxing or pillarboxing when the browser&#8217;s aspect ratio isn&#8217;t the same aspect ratio of the image.  There&#8217;s no way around that, and I hope it makes sense to you why.  Assuming you&#8217;re okay with that, here&#8217;s a quick suggestion that will scale the image without cropping:</p>
<pre><code>Stage.scaleMode = &quot;noScale&quot;;
Stage.align = &quot;TL&quot;;
var stageListener:Object = new Object ();
stageListener.onResize = positionContent;
Stage.addListener(stageListener);

function positionContent():Void {
  photo._width = Stage.width;
  photo._yscale = photo._xscale;
  if (photo._height > Stage.height) {
    photo._height = Stage.height;
    photo._xscale = photo._yscale;
  }
  photo._x = Stage.width / 2 - photo._width / 2;
  photo._y = Stage.height / 2 - photo._height / 2;
}
positionContent();</code></pre>
<p>The basic mechanics are very similar to my original code prior to any of the comments.  In this revision, the width of the photo is set to the width of the Stage.  The height (via <code>_yscale</code>) is adjusted by the same value as the width.  Then an <code>if</code> statement checks to see if the photo is now taller than the Stage.  If so, the same manipulation is performed in reverse.  After that, the image is centered (assuming an upper left registration point on the <code>photo</code> movie clip).  This means the image will never be cropped.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Cris</title>
		<link>http://www.quip.net/blog/2006/flash/how-to-position-movie-clips-browser-resizing#comment-282777</link>
		<pubDate>Thu, 02 Oct 2008 01:12:36 +0000</pubDate>
		<guid>http://www.quip.net/blog/2006/flash/how-to-position-movie-clips-browser-resizing#comment-282777</guid>
					<description>Hi David

I also wish to express my admiration for the time you are dedicating to help people out. 

I am making a photography website where the images scale with the browser window. But the problem with the way I'm doing it now is that the image sometimes gets cropped with the browser window. I would like the images to be displayed as large as possible but without without cropping. 

Thank you so much!

here is the code I'm using, from your responce to M.A. Turner:

Stage.align = &quot;TL&quot;;
Stage.scaleMode = &quot;noScale&quot;;
Stage.showMenu = false;
_global._focusrect = false;
_global._quality = &quot;BEST&quot;;
this._lockroot = true;

function set_stage() {
  // SET THE ASPECT RATIO
  original_width = 320;
  original_height = 240;

  scale_width = Stage.width/original_width;
  scale_height = Stage.height/original_height;

  if (scale_width&amp;#62;scale_height) {
    new_ratio = scale_width;
  } else {
    new_ratio = scale_height;
  }

  // THE CLIP YOU WANT TO SCALE
  my_mc._width = original_width*new_ratio;
  my_mc._height = original_height*new_ratio; }

Stage.addListener({onResize:set_stage});

set_stage();

stop();</description>
		<content:encoded><![CDATA[<p>Hi David</p>
<p>I also wish to express my admiration for the time you are dedicating to help people out. </p>
<p>I am making a photography website where the images scale with the browser window. But the problem with the way I&#8217;m doing it now is that the image sometimes gets cropped with the browser window. I would like the images to be displayed as large as possible but without without cropping. </p>
<p>Thank you so much!</p>
<p>here is the code I&#8217;m using, from your responce to M.A. Turner:</p>
<p>Stage.align = &#8220;TL&#8221;;<br />
Stage.scaleMode = &#8220;noScale&#8221;;<br />
Stage.showMenu = false;<br />
_global._focusrect = false;<br />
_global._quality = &#8220;BEST&#8221;;<br />
this._lockroot = true;</p>
<p>function set_stage() {<br />
  // SET THE ASPECT RATIO<br />
  original_width = 320;<br />
  original_height = 240;</p>
<p>  scale_width = Stage.width/original_width;<br />
  scale_height = Stage.height/original_height;</p>
<p>  if (scale_width&gt;scale_height) {<br />
    new_ratio = scale_width;<br />
  } else {<br />
    new_ratio = scale_height;<br />
  }</p>
<p>  // THE CLIP YOU WANT TO SCALE<br />
  my_mc._width = original_width*new_ratio;<br />
  my_mc._height = original_height*new_ratio; }</p>
<p>Stage.addListener({onResize:set_stage});</p>
<p>set_stage();</p>
<p>stop();
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Matt</title>
		<link>http://www.quip.net/blog/2006/flash/how-to-position-movie-clips-browser-resizing#comment-280463</link>
		<pubDate>Sun, 28 Sep 2008 09:39:35 +0000</pubDate>
		<guid>http://www.quip.net/blog/2006/flash/how-to-position-movie-clips-browser-resizing#comment-280463</guid>
					<description>Hi David,

Im sorry to bother you, I know you have a life. I really need your help, I have a pending deadline - and im really in a bad way in regards to this. The site depends on these sliders to function.

Please let me know if you can provide some light on my last post : September 26th, 2008 at 12:59 am

Thank you so much again for helping this far - if you can help me again it would be amazing! Your an actionscript god!

Thanks so much again and sorry for bothering you! Cheers.</description>
		<content:encoded><![CDATA[<p>Hi David,</p>
<p>Im sorry to bother you, I know you have a life. I really need your help, I have a pending deadline - and im really in a bad way in regards to this. The site depends on these sliders to function.</p>
<p>Please let me know if you can provide some light on my last post : September 26th, 2008 at 12:59 am</p>
<p>Thank you so much again for helping this far - if you can help me again it would be amazing! Your an actionscript god!</p>
<p>Thanks so much again and sorry for bothering you! Cheers.
</p>
]]></content:encoded>
				</item>
</channel>
</rss>

