<?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: Detecting whether an image loaded successfully in Flex</title>
	<atom:link href="http://blog.flexexamples.com/2007/11/04/detecting-whether-an-image-loaded-successfully-in-flex/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.flexexamples.com/2007/11/04/detecting-whether-an-image-loaded-successfully-in-flex/</link>
	<description>Just a bunch of Adobe Flex Examples</description>
	<lastBuildDate>Sun, 12 Feb 2012 14:19:03 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Bruno</title>
		<link>http://blog.flexexamples.com/2007/11/04/detecting-whether-an-image-loaded-successfully-in-flex/comment-page-1/#comment-9514</link>
		<dc:creator>Bruno</dc:creator>
		<pubDate>Fri, 19 Aug 2011 21:02:58 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/11/04/detecting-whether-an-image-loaded-successfully-in-flex/#comment-9514</guid>
		<description>For who is looking for an answer, test if the content is Bitmap, e.g.:

var image:Image;
//load image
...
trace(image.content is Bitmap); // true if its is loaded</description>
		<content:encoded><![CDATA[<p>For who is looking for an answer, test if the content is Bitmap, e.g.:</p>
<p>var image:Image;<br />
//load image<br />
&#8230;<br />
trace(image.content is Bitmap); // true if its is loaded</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cory</title>
		<link>http://blog.flexexamples.com/2007/11/04/detecting-whether-an-image-loaded-successfully-in-flex/comment-page-1/#comment-9384</link>
		<dc:creator>Cory</dc:creator>
		<pubDate>Fri, 08 Jul 2011 18:09:02 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/11/04/detecting-whether-an-image-loaded-successfully-in-flex/#comment-9384</guid>
		<description>Detecting if an image loaded successfully is as easy as 1.. 2.. 3.. 4......

This seems to be what is needed to get a reliable cross-browser load/fail for swfloader... what a PITA...

1. complete + init events. and compare bytes to make sure you have everything.  See http://numiko.com/labs/?p=268

2. ioError

3. Wrap your .load call with a try/catch to make sure you get any security errors, and then fire the load fail event manually if you do.

4. Manual timeout.  You need to write something that will track how long a load() has been active and timeout at some reasonable time for your app.  You then need to cancel the SWFLoader so that it doesn&#039;t eventually fire a complete/error down the road.  Looks like SWFLoader.unloadAndStop can so this, though I&#039;m not 100%.  

Since swfloader doesn&#039;t seem to have a timeout, it will wait as long as the remote server keeps your connection open and waiting (and your browser doesn&#039;t kill it).

In theory, a web server could send one byte at a time and keep swfloader waiting indefinitely.

One example:  In FF, I was contacting IIS for a site that has been stopped, it seems to take 1-2 minutes before the connection finally stops and flash hits an ioError event. 

In the meantime, flash fires no events that I can see, ioError or otherwise.  So for that entire time, your user will just be waiting, wondering what is going on.</description>
		<content:encoded><![CDATA[<p>Detecting if an image loaded successfully is as easy as 1.. 2.. 3.. 4&#8230;&#8230;</p>
<p>This seems to be what is needed to get a reliable cross-browser load/fail for swfloader&#8230; what a PITA&#8230;</p>
<p>1. complete + init events. and compare bytes to make sure you have everything.  See <a href="http://numiko.com/labs/?p=268" rel="nofollow">http://numiko.com/labs/?p=268</a></p>
<p>2. ioError</p>
<p>3. Wrap your .load call with a try/catch to make sure you get any security errors, and then fire the load fail event manually if you do.</p>
<p>4. Manual timeout.  You need to write something that will track how long a load() has been active and timeout at some reasonable time for your app.  You then need to cancel the SWFLoader so that it doesn&#8217;t eventually fire a complete/error down the road.  Looks like SWFLoader.unloadAndStop can so this, though I&#8217;m not 100%.  </p>
<p>Since swfloader doesn&#8217;t seem to have a timeout, it will wait as long as the remote server keeps your connection open and waiting (and your browser doesn&#8217;t kill it).</p>
<p>In theory, a web server could send one byte at a time and keep swfloader waiting indefinitely.</p>
<p>One example:  In FF, I was contacting IIS for a site that has been stopped, it seems to take 1-2 minutes before the connection finally stops and flash hits an ioError event. </p>
<p>In the meantime, flash fires no events that I can see, ioError or otherwise.  So for that entire time, your user will just be waiting, wondering what is going on.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: simone</title>
		<link>http://blog.flexexamples.com/2007/11/04/detecting-whether-an-image-loaded-successfully-in-flex/comment-page-1/#comment-9207</link>
		<dc:creator>simone</dc:creator>
		<pubDate>Mon, 09 May 2011 17:11:57 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/11/04/detecting-whether-an-image-loaded-successfully-in-flex/#comment-9207</guid>
		<description>Hi, i&#039;m using this procedure to check if image loaded correctly, but I&#039;m having problem on setting a default image when an error occurs. I would like to switch back to a default embedded image when server is returning other than 200 code.</description>
		<content:encoded><![CDATA[<p>Hi, i&#8217;m using this procedure to check if image loaded correctly, but I&#8217;m having problem on setting a default image when an error occurs. I would like to switch back to a default embedded image when server is returning other than 200 code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ling's</title>
		<link>http://blog.flexexamples.com/2007/11/04/detecting-whether-an-image-loaded-successfully-in-flex/comment-page-1/#comment-7681</link>
		<dc:creator>Ling's</dc:creator>
		<pubDate>Tue, 11 May 2010 11:58:51 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/11/04/detecting-whether-an-image-loaded-successfully-in-flex/#comment-7681</guid>
		<description>Hi.,
I am using     mx:MenuBar id=&quot;testmenu&quot;   labelField=&quot;menuLabel&quot;    iconField=&quot;menuIcon&quot;   dataProvider=&quot;{Datamenu}&quot; width=&quot;100%&quot; itemClick=&quot;ClickMenuItem(event);&quot; click=&quot;Select_MenuBar(event);&quot;
	

iconField is using class name as menuIcon is url image file.. how to load url image file to icon field.,

Any one help me..

Ling’s</description>
		<content:encoded><![CDATA[<p>Hi.,<br />
I am using     mx:MenuBar id=&#8221;testmenu&#8221;   labelField=&#8221;menuLabel&#8221;    iconField=&#8221;menuIcon&#8221;   dataProvider=&#8221;{Datamenu}&#8221; width=&#8221;100%&#8221; itemClick=&#8221;ClickMenuItem(event);&#8221; click=&#8221;Select_MenuBar(event);&#8221;</p>
<p>iconField is using class name as menuIcon is url image file.. how to load url image file to icon field.,</p>
<p>Any one help me..</p>
<p>Ling’s</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ling's</title>
		<link>http://blog.flexexamples.com/2007/11/04/detecting-whether-an-image-loaded-successfully-in-flex/comment-page-1/#comment-7680</link>
		<dc:creator>Ling's</dc:creator>
		<pubDate>Tue, 11 May 2010 11:55:43 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/11/04/detecting-whether-an-image-loaded-successfully-in-flex/#comment-7680</guid>
		<description>Hi.,
     I am using  

iconField is using class name as menuIcon is url image file.. how to load url image file to icon field.,

Any one help me..

Ling&#039;s</description>
		<content:encoded><![CDATA[<p>Hi.,<br />
     I am using  </p>
<p>iconField is using class name as menuIcon is url image file.. how to load url image file to icon field.,</p>
<p>Any one help me..</p>
<p>Ling&#8217;s</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter deHaan</title>
		<link>http://blog.flexexamples.com/2007/11/04/detecting-whether-an-image-loaded-successfully-in-flex/comment-page-1/#comment-7671</link>
		<dc:creator>Peter deHaan</dc:creator>
		<pubDate>Mon, 10 May 2010 14:38:49 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/11/04/detecting-whether-an-image-loaded-successfully-in-flex/#comment-7671</guid>
		<description>@Daniel,

You could try using a timer that runs every X seconds and does an HTTP get of a small file on your server. If the server connection fails, it is likely that the server or the internet connection is down and you could possibly display an alert/dialog.

Peter</description>
		<content:encoded><![CDATA[<p>@Daniel,</p>
<p>You could try using a timer that runs every X seconds and does an HTTP get of a small file on your server. If the server connection fails, it is likely that the server or the internet connection is down and you could possibly display an alert/dialog.</p>
<p>Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel Dourado</title>
		<link>http://blog.flexexamples.com/2007/11/04/detecting-whether-an-image-loaded-successfully-in-flex/comment-page-1/#comment-7670</link>
		<dc:creator>Daniel Dourado</dc:creator>
		<pubDate>Mon, 10 May 2010 13:11:41 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/11/04/detecting-whether-an-image-loaded-successfully-in-flex/#comment-7670</guid>
		<description>Hi Peter,

How can I send a message to the user when the connection to the internet drops?</description>
		<content:encoded><![CDATA[<p>Hi Peter,</p>
<p>How can I send a message to the user when the connection to the internet drops?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://blog.flexexamples.com/2007/11/04/detecting-whether-an-image-loaded-successfully-in-flex/comment-page-1/#comment-1797</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Thu, 30 Apr 2009 21:11:06 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/11/04/detecting-whether-an-image-loaded-successfully-in-flex/#comment-1797</guid>
		<description>Brian - your solution seems to work for me across browsers. Thanks a lot.</description>
		<content:encoded><![CDATA[<p>Brian &#8211; your solution seems to work for me across browsers. Thanks a lot.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian</title>
		<link>http://blog.flexexamples.com/2007/11/04/detecting-whether-an-image-loaded-successfully-in-flex/comment-page-1/#comment-1798</link>
		<dc:creator>Brian</dc:creator>
		<pubDate>Wed, 18 Mar 2009 21:26:53 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/11/04/detecting-whether-an-image-loaded-successfully-in-flex/#comment-1798</guid>
		<description>I&#039;m using &lt;code&gt;&lt;mx:Image id=&quot;myImg&quot; source=&quot;x&quot; ioError=&quot;myImg.source = null&quot;/&gt;&lt;/code&gt; and it seems to work fine in both IE and Firefox</description>
		<content:encoded><![CDATA[<p>I&#8217;m using <code>&lt;mx:Image id="myImg" source="x" ioError="myImg.source = null"/&gt;</code> and it seems to work fine in both IE and Firefox</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bryan</title>
		<link>http://blog.flexexamples.com/2007/11/04/detecting-whether-an-image-loaded-successfully-in-flex/comment-page-1/#comment-1804</link>
		<dc:creator>Bryan</dc:creator>
		<pubDate>Sat, 07 Mar 2009 00:19:45 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/11/04/detecting-whether-an-image-loaded-successfully-in-flex/#comment-1804</guid>
		<description>I&#039;ve found that the ioError Event is launched if there is a problem loading the image.
That&#039;s enough for me to know that I need to change the image for a &quot;Not available photo&quot; image, and it work in Firefox, so I suppose it is not browser dependant.

Hope that helps someone with a similar problem.</description>
		<content:encoded><![CDATA[<p>I&#8217;ve found that the ioError Event is launched if there is a problem loading the image.<br />
That&#8217;s enough for me to know that I need to change the image for a &#8220;Not available photo&#8221; image, and it work in Firefox, so I suppose it is not browser dependant.</p>
<p>Hope that helps someone with a similar problem.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

