<?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>Kalen Gibbons &#187; identifiers</title>
	<atom:link href="http://www.kalengibbons.com/blog/index.php/tag/identifiers/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kalengibbons.com/blog</link>
	<description>The Dead Tree Blog</description>
	<lastBuildDate>Wed, 10 Mar 2010 07:28:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Dynamic Identifiers In ActionScript 3.0</title>
		<link>http://www.kalengibbons.com/blog/index.php/2007/06/dynamic-identifiers-in-actionscript-30/</link>
		<comments>http://www.kalengibbons.com/blog/index.php/2007/06/dynamic-identifiers-in-actionscript-30/#comments</comments>
		<pubDate>Wed, 13 Jun 2007 09:49:26 +0000</pubDate>
		<dc:creator>Kalen Gibbons</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[How-To]]></category>
		<category><![CDATA[identifiers]]></category>

		<guid isPermaLink="false">http://www.kalengibbons.com/blog2/?p=3</guid>
		<description><![CDATA[I came across a problem in Flex the other day where I was trying to dynamically identify an image with ActionScript.&#160; I&#8217;ll spare you the programmatic details, all you need to know is that Coldfusion returns a string that corresponds to the name of an image inside my Flex application.&#160; The image name is then [...]]]></description>
			<content:encoded><![CDATA[<p>I came across a problem in Flex the other day where I was trying to dynamically identify an image with ActionScript.&nbsp; I&#8217;ll spare you the programmatic details, all you need to know is that Coldfusion returns a string that corresponds to the name of an image inside my Flex application.&nbsp; The image name is then used to modify the image object with the corresponding ID.<br />&nbsp;<br />Now, I know I could have accomplished my goal by using a Switch statement but the number of images in the application would have made the code tedious to write and hard to maintain.&nbsp; So after much searching I found how to dynamically identify objects in my flex application.</p>
<p>Here is an example of how to change the source of an image, where the image&#8217;s ID is produced dynamically.</p>
<p class="code">
<span class="asComment">// if the object is in the same component, use THIS scope</span><br />
<span class="asReserved">this</span>[imageName].source = &#8220;<span class="asString">images/newImage.jpg</span>&#8220;;<br />
<span class="asComment">// or if the object is part of a sub-component, use the component&#8217;s ID as the scope</span><br />
subComponentID[imageName].source = &#8220;<span class="asString">images/newImage.jpg</span>&#8220;;
</p>
<p>I hope this simple example is enough to clarify how to dynamically refer to an ID of an object in ActionScript 3.0; I did a lot of googling before I figured out the syntax for this &#8211; even though it&#8217;s rather simple.&nbsp; So I hope this is enough to save some of you a bit of searching.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kalengibbons.com/blog/index.php/2007/06/dynamic-identifiers-in-actionscript-30/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
