<?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: Loading external images with ActionScript 3</title>
	<atom:link href="http://www.flashnutz.com/2009/02/loading-external-images-with-actionscript-3/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.flashnutz.com/2009/02/loading-external-images-with-actionscript-3/</link>
	<description>HELPING WEB DEVELOPERS DEVELOP</description>
	<lastBuildDate>Thu, 29 Jul 2010 23:29:01 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
	<item>
		<title>By: BushMarina26</title>
		<link>http://www.flashnutz.com/2009/02/loading-external-images-with-actionscript-3/comment-page-1/#comment-6022</link>
		<dc:creator>BushMarina26</dc:creator>
		<pubDate>Mon, 14 Jun 2010 15:42:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.flashnutz.com/?p=63#comment-6022</guid>
		<description>I opine that to receive the &lt;a href=&quot;http://lowest-rate-loans.com/topics/home-loans&quot; rel=&quot;nofollow&quot;&gt;home loans&lt;/a&gt; from creditors you must have a good reason. However, once I have received a collateral loan, just because I was willing to buy a building.</description>
		<content:encoded><![CDATA[<p>I opine that to receive the <a href="http://lowest-rate-loans.com/topics/home-loans" rel="nofollow">home loans</a> from creditors you must have a good reason. However, once I have received a collateral loan, just because I was willing to buy a building.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: atasözleri</title>
		<link>http://www.flashnutz.com/2009/02/loading-external-images-with-actionscript-3/comment-page-1/#comment-4287</link>
		<dc:creator>atasözleri</dc:creator>
		<pubDate>Thu, 25 Feb 2010 13:24:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.flashnutz.com/?p=63#comment-4287</guid>
		<description>Thanks you very much!

I am find to long time this codes! Wonderful working, thank again!</description>
		<content:encoded><![CDATA[<p>Thanks you very much!</p>
<p>I am find to long time this codes! Wonderful working, thank again!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cclater</title>
		<link>http://www.flashnutz.com/2009/02/loading-external-images-with-actionscript-3/comment-page-1/#comment-3484</link>
		<dc:creator>cclater</dc:creator>
		<pubDate>Thu, 11 Feb 2010 00:02:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.flashnutz.com/?p=63#comment-3484</guid>
		<description>This was a very good description of the Loader class.  Thank you.  NOw my question is, how do you loop this code to outputting multiple images from an array?  I can do it with shapes and such but for some reason this loader class seems to get in the way of allowing me to output more than just the last image in my array loop.  I think it&#039;s making me crazy...</description>
		<content:encoded><![CDATA[<p>This was a very good description of the Loader class.  Thank you.  NOw my question is, how do you loop this code to outputting multiple images from an array?  I can do it with shapes and such but for some reason this loader class seems to get in the way of allowing me to output more than just the last image in my array loop.  I think it&#8217;s making me crazy&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Flashnutz</title>
		<link>http://www.flashnutz.com/2009/02/loading-external-images-with-actionscript-3/comment-page-1/#comment-3243</link>
		<dc:creator>Flashnutz</dc:creator>
		<pubDate>Fri, 22 Jan 2010 02:28:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.flashnutz.com/?p=63#comment-3243</guid>
		<description>Hi Pharos,
     I was writing the response while you figured it out. Here it is any way..

var imgLoader:Loader =  new Loader();
imgLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaderCompleteHandler);
imgLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, preloaderHandler);
 
function loaderCompleteHandler(e:Event):void{
	trace(&#039;Image has loaded.&#039;);
	
	//create movieclip that will hold the img
	var imageHolder:MovieClip = new MovieClip();
	
	//Add the holder to the stage
	addChild(imageHolder);
	
	//Save the loaded bitmap to a local variable
	var image:Bitmap = (Bitmap)(e.target.content);

	// add the image to the movieclip
	imageHolder.addChild(image);
	
	//position the holder to where you want
	imageHolder.x = stage.width/2;
	imageHolder.y = 50;
}
 
function preloaderHandler(e:ProgressEvent):void{
	trace(&#039;bytesLoaded:  &#039; + e.bytesLoaded);
	trace(&#039;bytesTotal:  &#039; + e.bytesTotal);
	trace(&#039;percentage loaded:  &#039; +
	Math.round((e.bytesLoaded/e.bytesTotal)*100) + &quot;%&quot;);
}
 
imgLoader.load(new URLRequest(&#039;http://www.flashnutz.com/FN.jpg&#039;));</description>
		<content:encoded><![CDATA[<p>Hi Pharos,<br />
     I was writing the response while you figured it out. Here it is any way..</p>
<p>var imgLoader:Loader =  new Loader();<br />
imgLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaderCompleteHandler);<br />
imgLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, preloaderHandler);</p>
<p>function loaderCompleteHandler(e:Event):void{<br />
	trace(&#8216;Image has loaded.&#8217;);</p>
<p>	//create movieclip that will hold the img<br />
	var imageHolder:MovieClip = new MovieClip();</p>
<p>	//Add the holder to the stage<br />
	addChild(imageHolder);</p>
<p>	//Save the loaded bitmap to a local variable<br />
	var image:Bitmap = (Bitmap)(e.target.content);</p>
<p>	// add the image to the movieclip<br />
	imageHolder.addChild(image);</p>
<p>	//position the holder to where you want<br />
	imageHolder.x = stage.width/2;<br />
	imageHolder.y = 50;<br />
}</p>
<p>function preloaderHandler(e:ProgressEvent):void{<br />
	trace(&#8216;bytesLoaded:  &#8216; + e.bytesLoaded);<br />
	trace(&#8216;bytesTotal:  &#8216; + e.bytesTotal);<br />
	trace(&#8216;percentage loaded:  &#8216; +<br />
	Math.round((e.bytesLoaded/e.bytesTotal)*100) + &#8220;%&#8221;);<br />
}</p>
<p>imgLoader.load(new URLRequest(&#8216;http://www.flashnutz.com/FN.jpg&#8217;));</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pharos</title>
		<link>http://www.flashnutz.com/2009/02/loading-external-images-with-actionscript-3/comment-page-1/#comment-3242</link>
		<dc:creator>Pharos</dc:creator>
		<pubDate>Fri, 22 Jan 2010 02:16:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.flashnutz.com/?p=63#comment-3242</guid>
		<description>Never mind.  Figured it out.

imgLoader.x=-100;
imgLoader.y=-36;</description>
		<content:encoded><![CDATA[<p>Never mind.  Figured it out.</p>
<p>imgLoader.x=-100;<br />
imgLoader.y=-36;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pharos</title>
		<link>http://www.flashnutz.com/2009/02/loading-external-images-with-actionscript-3/comment-page-1/#comment-3241</link>
		<dc:creator>Pharos</dc:creator>
		<pubDate>Fri, 22 Jan 2010 02:10:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.flashnutz.com/?p=63#comment-3241</guid>
		<description>Would you be so kind to add the code that allows repositioning?

The code works great, but I need to position the image.

Thank you.</description>
		<content:encoded><![CDATA[<p>Would you be so kind to add the code that allows repositioning?</p>
<p>The code works great, but I need to position the image.</p>
<p>Thank you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Groggles</title>
		<link>http://www.flashnutz.com/2009/02/loading-external-images-with-actionscript-3/comment-page-1/#comment-1548</link>
		<dc:creator>Groggles</dc:creator>
		<pubDate>Wed, 12 Aug 2009 03:00:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.flashnutz.com/?p=63#comment-1548</guid>
		<description>[Many]</description>
		<content:encoded><![CDATA[<p>[Many]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Groggles</title>
		<link>http://www.flashnutz.com/2009/02/loading-external-images-with-actionscript-3/comment-page-1/#comment-1547</link>
		<dc:creator>Groggles</dc:creator>
		<pubDate>Wed, 12 Aug 2009 03:00:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.flashnutz.com/?p=63#comment-1547</guid>
		<description>Complete sense. That&#039;s really very helpful. I have integrated it into my code and it works as expected. any thanks.</description>
		<content:encoded><![CDATA[<p>Complete sense. That&#8217;s really very helpful. I have integrated it into my code and it works as expected. any thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Flashnutz</title>
		<link>http://www.flashnutz.com/2009/02/loading-external-images-with-actionscript-3/comment-page-1/#comment-1543</link>
		<dc:creator>Flashnutz</dc:creator>
		<pubDate>Wed, 12 Aug 2009 00:14:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.flashnutz.com/?p=63#comment-1543</guid>
		<description>&lt;a href=&quot;#comment-1532&quot; rel=&quot;nofollow&quot;&gt;@Groggles&lt;/a&gt; 

There are a few ways you could achieve this and yes one of them is using an array.

For example lets say you were reading the images from an xml file you would do the following.




&lt;blockquote&gt;var numImages:Number; //declare total number of images var.
var imgLoadedCount:Number;//declare the image counter variable.

//once the xml is loaded start loading the images
function xmlReady(evt:Event):void {
		
	xmlData = XML(xmlLoader.data);	

       //get the total number of images
	numImages = xmlData.img.length(); 
	
	for( var i:Number = 0; i &lt; numImages; ++i ){		
		 
        //get file name 
	 var imageName:String = xmlData.img[i].toString();		 
		 
	var imgLoader:Loader = new Loader();
       
        // when image is ready call the imgReady function that 
         will check if all images have been loaded.
    	 imgLoader.contentLoaderInfo.addEventListener
         (Event.COMPLETE, imgReady); 
    	
          imgLoader.load(new URLRequest(imageName));
	
	}
} 

function imgReady(evt:Event):void{	

       imgLoadedCount++; //update the image loaded count

     if(imgLoadedCount==numImages){
          //all images have finished loading
     }
	
}&lt;/blockquote&gt;



Hope that makes sense...
</description>
		<content:encoded><![CDATA[<p><a href="#comment-1532" rel="nofollow">@Groggles</a> </p>
<p>There are a few ways you could achieve this and yes one of them is using an array.</p>
<p>For example lets say you were reading the images from an xml file you would do the following.</p>
<blockquote><p>var numImages:Number; //declare total number of images var.<br />
var imgLoadedCount:Number;//declare the image counter variable.</p>
<p>//once the xml is loaded start loading the images<br />
function xmlReady(evt:Event):void {</p>
<p>	xmlData = XML(xmlLoader.data);	</p>
<p>       //get the total number of images<br />
	numImages = xmlData.img.length(); </p>
<p>	for( var i:Number = 0; i < numImages; ++i ){		</p>
<p>        //get file name<br />
	 var imageName:String = xmlData.img[i].toString();		 </p>
<p>	var imgLoader:Loader = new Loader();</p>
<p>        // when image is ready call the imgReady function that<br />
         will check if all images have been loaded.<br />
    	 imgLoader.contentLoaderInfo.addEventListener<br />
         (Event.COMPLETE, imgReady); </p>
<p>          imgLoader.load(new URLRequest(imageName));</p>
<p>	}<br />
} </p>
<p>function imgReady(evt:Event):void{	</p>
<p>       imgLoadedCount++; //update the image loaded count</p>
<p>     if(imgLoadedCount==numImages){<br />
          //all images have finished loading<br />
     }</p>
<p>}</p></blockquote>
<p>Hope that makes sense&#8230;</p></blockquote>
]]></content:encoded>
	</item>
	<item>
		<title>By: Groggles</title>
		<link>http://www.flashnutz.com/2009/02/loading-external-images-with-actionscript-3/comment-page-1/#comment-1532</link>
		<dc:creator>Groggles</dc:creator>
		<pubDate>Tue, 11 Aug 2009 06:29:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.flashnutz.com/?p=63#comment-1532</guid>
		<description>Thanks for the response. I never did work it out. Just left an event listener on the last image. I&#039;m assuming that using an array might be part of the answer. Anyhow, any help would be appreciated.  Cheers.</description>
		<content:encoded><![CDATA[<p>Thanks for the response. I never did work it out. Just left an event listener on the last image. I&#8217;m assuming that using an array might be part of the answer. Anyhow, any help would be appreciated.  Cheers.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
