<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.1" -->
<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: Grids: Arranging Clips</title>
	<link>http://www.learningactionscript3.com/2008/05/17/grids-arranging-clips/</link>
	<description>A digital supplement for the O'Reilly book</description>
	<pubDate>Wed, 20 Aug 2008 13:04:28 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
		<item>
		<title>By: Seb</title>
		<link>http://www.learningactionscript3.com/2008/05/17/grids-arranging-clips/#comment-176</link>
		<dc:creator>Seb</dc:creator>
		<pubDate>Tue, 29 Jul 2008 15:45:13 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2008/05/17/grids-arranging-clips/#comment-176</guid>
		<description>I'm dynamically loading the movieclips on the stage to be used as buttons.
I need 6 to be displayed at once on a single page.
When loading more than six , I would like this to create a new page that contains the rest, and so on in sets of six.

In addition I would like a new thumbnail button be appear (page 1, page 2, ecc..) in order to jump between the various pages.


Can anyone help ?

Thanks</description>
		<content:encoded><![CDATA[<p>I&#8217;m dynamically loading the movieclips on the stage to be used as buttons.<br />
I need 6 to be displayed at once on a single page.<br />
When loading more than six , I would like this to create a new page that contains the rest, and so on in sets of six.</p>
<p>In addition I would like a new thumbnail button be appear (page 1, page 2, ecc..) in order to jump between the various pages.</p>
<p>Can anyone help ?</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rich</title>
		<link>http://www.learningactionscript3.com/2008/05/17/grids-arranging-clips/#comment-167</link>
		<dc:creator>Rich</dc:creator>
		<pubDate>Wed, 23 Jul 2008 13:56:12 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2008/05/17/grids-arranging-clips/#comment-167</guid>
		<description>@thawootah, Yikes! Thanks for that screenshot. We still have a lot of work to do on getting the site to where we want it, and I'll add this to the list. I appreciate the comment.</description>
		<content:encoded><![CDATA[<p>@thawootah, Yikes! Thanks for that screenshot. We still have a lot of work to do on getting the site to where we want it, and I&#8217;ll add this to the list. I appreciate the comment.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: thawootah</title>
		<link>http://www.learningactionscript3.com/2008/05/17/grids-arranging-clips/#comment-166</link>
		<dc:creator>thawootah</dc:creator>
		<pubDate>Tue, 22 Jul 2008 23:43:42 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2008/05/17/grids-arranging-clips/#comment-166</guid>
		<description>Thanks for the help! Yeah AS3 should be easy after i figure out all the new lingo. Sometimes i feel like i just switched from swish to flash 5. 

about the form, I'm using XP and Firefox 3. the text is a few pixels too small but It's no biggie i just zoom in. here's a screen shot. 

&lt;a href="http://img66.imageshack.us/img66/2365/thetext722200864005pmng5.jpg" rel="nofollow"&gt;image shack&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>Thanks for the help! Yeah AS3 should be easy after i figure out all the new lingo. Sometimes i feel like i just switched from swish to flash 5. </p>
<p>about the form, I&#8217;m using XP and Firefox 3. the text is a few pixels too small but It&#8217;s no biggie i just zoom in. here&#8217;s a screen shot. </p>
<p><a href="http://img66.imageshack.us/img66/2365/thetext722200864005pmng5.jpg" rel="nofollow">image shack</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rich</title>
		<link>http://www.learningactionscript3.com/2008/05/17/grids-arranging-clips/#comment-164</link>
		<dc:creator>Rich</dc:creator>
		<pubDate>Tue, 22 Jul 2008 13:07:40 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2008/05/17/grids-arranging-clips/#comment-164</guid>
		<description>@Ken, pa_dutch, thawootah:

There are a bunch of ways to do this, but I've written one that requires the least change to the existing script so it can be easily added here and easily explained. Based on the questions, we're assuming you know how to get the path of the object for each box (thumbnail or other content) from your XML. We may follow this up with a more in-depth post, but this will definitely get you started. Just add the following to the &lt;span class="inlineas"&gt;if&lt;/span&gt; segment of the &lt;span class="inlineas"&gt;if..else&lt;/span&gt; statement (after line 23) of the last script:

&lt;span class="inlineas"&gt;&lt;pre&gt;
var ldr:Loader = new Loader();
box.addChild(ldr);

var loadPath:String = "path_to_content_from_xml.jpg";
ldr.load(new URLRequest(loadPath));
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, onContentReady,
					 false, 0, true);
function onContentReady(evt:Event):void {
	var loaded:DisplayObject = evt.target.content;
	loaded.x -= box.width/2;
	loaded.y -= box.height/2;
	loaded.width = box.width;
	loaded.height = box.height;
}
&lt;/pre&gt;&lt;/span&gt;

To load the external display data, you need an instance of the Loader class. The first two lines of the insert create the instance and load it to the box.

The next block of the insert loads the content and process it after loading for cosmetic purposes. The first line is the thumbnail path that, based on the questions, would be parsed from an XML instance. The next line loads the content, and the third line of the block adds an event listener that will trigger a function that positions and scales the content after loading. 

Finally, the event handler function is added. This will vary depending on your needs. In the original example, a movie clip in the library contained a shape, an the clip has a center registration point. All this function does is set the &lt;span class="inlineas"&gt;x&lt;/span&gt; and &lt;span class="inlineas"&gt;y&lt;/span&gt; of the loaded content to the upper-left corner of the container, and sets the &lt;span class="inlineas"&gt;width&lt;/span&gt; and &lt;span class="inlineas"&gt;height&lt;/span&gt; of the loaded content to that of the container. 

This entire listener and function could be eliminated if you sized the loaded content to the container and used a container with a top-left registration point. Or, you may require additional treatment, such as when the content doesn't match the shape of the container. That is, this simple example just matches the width and height of the container, but doesn't scale proportionally. You could add code to accomplish that if desired, or even switch to using a component that will auto-scale, if you prefer.</description>
		<content:encoded><![CDATA[<p>@Ken, pa_dutch, thawootah:</p>
<p>There are a bunch of ways to do this, but I&#8217;ve written one that requires the least change to the existing script so it can be easily added here and easily explained. Based on the questions, we&#8217;re assuming you know how to get the path of the object for each box (thumbnail or other content) from your XML. We may follow this up with a more in-depth post, but this will definitely get you started. Just add the following to the <span class="inlineas">if</span> segment of the <span class="inlineas">if..else</span> statement (after line 23) of the last script:</p>
<p><span class="inlineas">
<pre>
var ldr:Loader = new Loader();
box.addChild(ldr);

var loadPath:String = "path_to_content_from_xml.jpg";
ldr.load(new URLRequest(loadPath));
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, onContentReady,
					 false, 0, true);
function onContentReady(evt:Event):void {
	var loaded:DisplayObject = evt.target.content;
	loaded.x -= box.width/2;
	loaded.y -= box.height/2;
	loaded.width = box.width;
	loaded.height = box.height;
}
</pre>
<p></span></p>
<p>To load the external display data, you need an instance of the Loader class. The first two lines of the insert create the instance and load it to the box.</p>
<p>The next block of the insert loads the content and process it after loading for cosmetic purposes. The first line is the thumbnail path that, based on the questions, would be parsed from an XML instance. The next line loads the content, and the third line of the block adds an event listener that will trigger a function that positions and scales the content after loading. </p>
<p>Finally, the event handler function is added. This will vary depending on your needs. In the original example, a movie clip in the library contained a shape, an the clip has a center registration point. All this function does is set the <span class="inlineas">x</span> and <span class="inlineas">y</span> of the loaded content to the upper-left corner of the container, and sets the <span class="inlineas">width</span> and <span class="inlineas">height</span> of the loaded content to that of the container. </p>
<p>This entire listener and function could be eliminated if you sized the loaded content to the container and used a container with a top-left registration point. Or, you may require additional treatment, such as when the content doesn&#8217;t match the shape of the container. That is, this simple example just matches the width and height of the container, but doesn&#8217;t scale proportionally. You could add code to accomplish that if desired, or even switch to using a component that will auto-scale, if you prefer.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rich</title>
		<link>http://www.learningactionscript3.com/2008/05/17/grids-arranging-clips/#comment-163</link>
		<dc:creator>Rich</dc:creator>
		<pubDate>Tue, 22 Jul 2008 12:43:49 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2008/05/17/grids-arranging-clips/#comment-163</guid>
		<description>@ron:

Zevan wrote an &lt;a href="/2008/06/06/tweenlite-introduction/" rel="nofollow"&gt;introduction to TweenLite&lt;/a&gt; that does what you're asking about. The last example in the post, the fake banner, tweens in 5 elements or so, sequentially. You should be able to adapt the technique for Tweener fairly easily. Let us know if that helps.</description>
		<content:encoded><![CDATA[<p>@ron:</p>
<p>Zevan wrote an <a href="/2008/06/06/tweenlite-introduction/" rel="nofollow">introduction to TweenLite</a> that does what you&#8217;re asking about. The last example in the post, the fake banner, tweens in 5 elements or so, sequentially. You should be able to adapt the technique for Tweener fairly easily. Let us know if that helps.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rich</title>
		<link>http://www.learningactionscript3.com/2008/05/17/grids-arranging-clips/#comment-162</link>
		<dc:creator>Rich</dc:creator>
		<pubDate>Tue, 22 Jul 2008 12:23:21 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2008/05/17/grids-arranging-clips/#comment-162</guid>
		<description>@Riley, @thawootah:

Naming the box is accomplished by setting the &lt;span class="inlineas"&gt;name&lt;/span&gt; property, at line 13 of the last script above. (The new line is in bold.)

&lt;span class="inlineas"&gt;var box:Box = new Box();&lt;br/&gt;
&lt;b&gt;box.name = "box" + boxCount;&lt;/b&gt;&lt;/span&gt;

However, you can't access an instance name that is programmatically assigned, the same way as manual assignments. Instead, use the following:

&lt;span class="inlineas"&gt;var clip:MovieClip = getChildByName("box0");&lt;/span&gt; 
or, if in a loop:
&lt;span class="inlineas"&gt;var clip:MovieClip = getChildByName("box" + i);&lt;/span&gt;
where &lt;span class="inlineas"&gt;i&lt;/span&gt; is the loop counter.

@thawootah, would you mind sending an email using the contact form to describe the trouble you're having with the comment form? It looks very clear to me so I think this might be a platform/browser-specific CSS issue. Can you tell me which OS/browser you're using and why you can't see what you're typing? Thanks.</description>
		<content:encoded><![CDATA[<p>@Riley, @thawootah:</p>
<p>Naming the box is accomplished by setting the <span class="inlineas">name</span> property, at line 13 of the last script above. (The new line is in bold.)</p>
<p><span class="inlineas">var box:Box = new Box();<br />
<b>box.name = &#8220;box&#8221; + boxCount;</b></span></p>
<p>However, you can&#8217;t access an instance name that is programmatically assigned, the same way as manual assignments. Instead, use the following:</p>
<p><span class="inlineas">var clip:MovieClip = getChildByName(&#8221;box0&#8243;);</span><br />
or, if in a loop:<br />
<span class="inlineas">var clip:MovieClip = getChildByName(&#8221;box&#8221; + i);</span><br />
where <span class="inlineas">i</span> is the loop counter.</p>
<p>@thawootah, would you mind sending an email using the contact form to describe the trouble you&#8217;re having with the comment form? It looks very clear to me so I think this might be a platform/browser-specific CSS issue. Can you tell me which OS/browser you&#8217;re using and why you can&#8217;t see what you&#8217;re typing? Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: thawootah</title>
		<link>http://www.learningactionscript3.com/2008/05/17/grids-arranging-clips/#comment-160</link>
		<dc:creator>thawootah</dc:creator>
		<pubDate>Tue, 22 Jul 2008 02:37:17 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2008/05/17/grids-arranging-clips/#comment-160</guid>
		<description>Yes i would like to know the same thing how can we dynamically add these clips with a unique name like AS2 attachMovie("myCLip" i);. Then add the unique id to array and access them?

or say you use dynamic text in the clip or a image how would you point xml into it?


also i can barely see what I'm typing in this form haha. Good tutorial though.</description>
		<content:encoded><![CDATA[<p>Yes i would like to know the same thing how can we dynamically add these clips with a unique name like AS2 attachMovie(&#8221;myCLip&#8221; i);. Then add the unique id to array and access them?</p>
<p>or say you use dynamic text in the clip or a image how would you point xml into it?</p>
<p>also i can barely see what I&#8217;m typing in this form haha. Good tutorial though.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Riley</title>
		<link>http://www.learningactionscript3.com/2008/05/17/grids-arranging-clips/#comment-132</link>
		<dc:creator>Riley</dc:creator>
		<pubDate>Thu, 03 Jul 2008 05:17:59 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2008/05/17/grids-arranging-clips/#comment-132</guid>
		<description>As each box gets created (var box:Box = new Box();) in the For ...loop, wouldn't it be best to uniquely name each box? like: box1, box2, box3? .. in case they needed to be referred to from somewhere else (not just mouse over events)? 

If so, how would you do this?  --- var box:Box = new Box();--- doesn't seem to offer that option.</description>
		<content:encoded><![CDATA[<p>As each box gets created (var box:Box = new Box();) in the For &#8230;loop, wouldn&#8217;t it be best to uniquely name each box? like: box1, box2, box3? .. in case they needed to be referred to from somewhere else (not just mouse over events)? </p>
<p>If so, how would you do this?  &#8212; var box:Box = new Box();&#8212; doesn&#8217;t seem to offer that option.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ron</title>
		<link>http://www.learningactionscript3.com/2008/05/17/grids-arranging-clips/#comment-125</link>
		<dc:creator>ron</dc:creator>
		<pubDate>Thu, 26 Jun 2008 20:10:23 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2008/05/17/grids-arranging-clips/#comment-125</guid>
		<description>Hi

thanks for this great tutorial (and not just that one).

i`m building a gallery with this notion of the grid and i try to use Tweener to make the thumb appear one by one and not all at the same time, but i fail to do so.

how can i do that?

best regards</description>
		<content:encoded><![CDATA[<p>Hi</p>
<p>thanks for this great tutorial (and not just that one).</p>
<p>i`m building a gallery with this notion of the grid and i try to use Tweener to make the thumb appear one by one and not all at the same time, but i fail to do so.</p>
<p>how can i do that?</p>
<p>best regards</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pa_dutch</title>
		<link>http://www.learningactionscript3.com/2008/05/17/grids-arranging-clips/#comment-119</link>
		<dc:creator>pa_dutch</dc:creator>
		<pubDate>Tue, 17 Jun 2008 04:07:35 +0000</pubDate>
		<guid>http://www.learningactionscript3.com/2008/05/17/grids-arranging-clips/#comment-119</guid>
		<description>Curious if you had time to post a show that explained what Ken Griffin (#1) asked for...I'm curious too...loading XML images into this thumbnailed grid. Thanks for the help.</description>
		<content:encoded><![CDATA[<p>Curious if you had time to post a show that explained what Ken Griffin (#1) asked for&#8230;I&#8217;m curious too&#8230;loading XML images into this thumbnailed grid. Thanks for the help.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
