<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>theDeSilva.com&#187; Width</title>
	<atom:link href="http://www.thedesilva.com/tag/width/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thedesilva.com</link>
	<description>Andrew de Silva</description>
	<lastBuildDate>Tue, 26 Apr 2011 20:24:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Width and Height for Dynamic Image in Flex</title>
		<link>http://www.thedesilva.com/2008/07/width-and-height-for-dynamic-image/</link>
		<comments>http://www.thedesilva.com/2008/07/width-and-height-for-dynamic-image/#comments</comments>
		<pubDate>Wed, 16 Jul 2008 22:03:42 +0000</pubDate>
		<dc:creator>Andrew de Silva</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[dynamic image]]></category>
		<category><![CDATA[Height]]></category>
		<category><![CDATA[Image]]></category>
		<category><![CDATA[Width]]></category>

		<guid isPermaLink="false">http://www.thedesilva.com/?p=38</guid>
		<description><![CDATA[<img src="http://www.thedesilva.com/img/category_icon//flash_small.png" width="32" height="32" alt="" title="Flash" /><img src="http://www.thedesilva.com/img/category_icon//flex-icon-small.png" width="32" height="32" alt="" title="Flex" /><br/>Recently I was working on a Flex project and realize upon having my project on the live server , I couldn&#8217;t retrieve the height and width property of my loaded image by doing below var img:Image = new Image&#40;&#41;; img.source = &#34;image.jpg&#34; trace&#40;img.height&#41;; trace&#40;img.width&#41;; The trace statement above will just show 0 for both width [...]]]></description>
			<content:encoded><![CDATA[<img src="http://www.thedesilva.com/img/category_icon//flash_small.png" width="32" height="32" alt="" title="Flash" /><img src="http://www.thedesilva.com/img/category_icon//flex-icon-small.png" width="32" height="32" alt="" title="Flex" /><br/><p>Recently I was working on a Flex project and realize upon having my project on the live server , I couldn&#8217;t retrieve the height and width property of my loaded image by doing below</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> img:Image = <span style="color: #000000; font-weight: bold;">new</span> Image<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
img.<span style="color: #006600;">source</span> = <span style="color: #ff0000;">&quot;image.jpg&quot;</span>
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>img.<span style="color: #0066CC;">height</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>img.<span style="color: #0066CC;">width</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>The trace statement above will just show 0 for both width and height. Of course after a few hours of searching Google for a solution I realized on the livedocs documentation for Image has the property contentWidth and contentHeight which provides the height and width of the image loaded.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> img:Image = <span style="color: #000000; font-weight: bold;">new</span> Image<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
img.<span style="color: #006600;">source</span> = <span style="color: #ff0000;">&quot;image.jpg&quot;</span>
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>img.<span style="color: #006600;">contentHeight</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span>img.<span style="color: #006600;">contentWidth</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.thedesilva.com/2008/07/width-and-height-for-dynamic-image/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

