<?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>Ace on Tech &#187; ActionScript</title>
	<atom:link href="http://aceontech.com/tag/actionscript/feed/" rel="self" type="application/rss+xml" />
	<link>http://aceontech.com</link>
	<description>Design Intentionally Left Out</description>
	<lastBuildDate>Mon, 06 Sep 2010 19:39:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Flex/AIR: DynamicEvent</title>
		<link>http://aceontech.com/2010/01/10/flexair-dynamicevent/</link>
		<comments>http://aceontech.com/2010/01/10/flexair-dynamicevent/#comments</comments>
		<pubDate>Sun, 10 Jan 2010 19:40:02 +0000</pubDate>
		<dc:creator>Ace</dc:creator>
				<category><![CDATA[Web Development & Design]]></category>
		<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://aceontech.com/?p=1074</guid>
		<description><![CDATA[Applies to: Adobe Flex &#38; AIR A DynamicEvent is a type of custom event in Flex that is easier and quicker to set up than the full-blown approach. By applying the latter method, you normally go through the following steps: &#8230; <a href="http://aceontech.com/2010/01/10/flexair-dynamicevent/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><strong>Applies to:</strong> Adobe Flex &amp; AIR</p>
<p>A DynamicEvent is a type of custom event in Flex that is easier and quicker to set up than the full-blown approach. By applying the latter method, you normally go through the following steps:</p>
<ol>
<li>Define a subclass from flash.events.Event</li>
<li>Make the event available to other ActionScript (through addEventListenter()) components or MXML components (using the [Event] metatag)</li>
<li>Dispatch the event, using dispatchEvent()</li>
</ol>
<p>Full documentation on custom events can be found in Adobe&#8217;s LiveDocs, <a title="LiveDocs article on Custom Event Dispatching" href="http://livedocs.adobe.com/flex/3/html/help.html?content=createevents_3.html">here</a>.</p>
<p>Generally one uses the above approach when you need to pass arguments to the code that&#8217;s targeted by the event. When you don&#8217;t require this, however, you can opt for the DynamicEvent. It&#8217;s not necessary to go through the whole rigamarole of subclassing; all you need is a name for the event, like so:</p>
<div id="wpshdo_1" class="wp-synhighlighter-outer"><div id="wpshdt_1" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_1"></a><a id="wpshat_1" class="wp-synhighlighter-title" href="#codesyntax_1"  onClick="javascript:wpsh_toggleBlock(1)" title="Click to show/hide code block">Code block</a></td><td align="right"><a href="#codesyntax_1" onClick="javascript:wpsh_code(1)" title="Show code only"><img border="0" style="border: 0 none" src="http://aceontech.com/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_1" onClick="javascript:wpsh_print(1)" title="Print code"><img border="0" style="border: 0 none" src="http://aceontech.com/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://aceontech.com/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://aceontech.com/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_1" class="wp-synhighlighter-inner" style="display: block;"><pre class="actionscript3" style="font-family:monospace;"><span class="kw2">var</span> yourEvent<span class="sy0">:</span>DynamicEvent = <span class="kw1">new</span> DynamicEvent<span class="br0">&#40;</span><span class="st0">&quot;yourEventName&quot;</span><span class="sy0">,</span> <span class="kw1">true</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="kw7">dispatchEvent</span><span class="br0">&#40;</span>yourEvent<span class="br0">&#41;</span><span class="sy0">;</span></pre></div></div>
<p>The second argument set to true means the event will bubble.</p>
<p><a href="http://www.addtoany.com/add_to/twitter?linkurl=http%3A%2F%2Faceontech.com%2F2010%2F01%2F10%2Fflexair-dynamicevent%2F&amp;linkname=Flex%2FAIR%3A%20DynamicEvent" title="Twitter" rel="nofollow" target="_blank"><img src="http://aceontech.com/wp-content/plugins/add-to-any/icons/twitter.png" width="16" height="16" alt="Twitter"/></a> <a href="http://www.addtoany.com/add_to/slashdot?linkurl=http%3A%2F%2Faceontech.com%2F2010%2F01%2F10%2Fflexair-dynamicevent%2F&amp;linkname=Flex%2FAIR%3A%20DynamicEvent" title="Slashdot" rel="nofollow" target="_blank"><img src="http://aceontech.com/wp-content/plugins/add-to-any/icons/slashdot.png" width="16" height="16" alt="Slashdot"/></a> <a href="http://www.addtoany.com/add_to/instapaper?linkurl=http%3A%2F%2Faceontech.com%2F2010%2F01%2F10%2Fflexair-dynamicevent%2F&amp;linkname=Flex%2FAIR%3A%20DynamicEvent" title="Instapaper" rel="nofollow" target="_blank"><img src="http://aceontech.com/wp-content/plugins/add-to-any/icons/instapaper.png" width="16" height="16" alt="Instapaper"/></a> <a href="http://www.addtoany.com/add_to/digg?linkurl=http%3A%2F%2Faceontech.com%2F2010%2F01%2F10%2Fflexair-dynamicevent%2F&amp;linkname=Flex%2FAIR%3A%20DynamicEvent" title="Digg" rel="nofollow" target="_blank"><img src="http://aceontech.com/wp-content/plugins/add-to-any/icons/digg.png" width="16" height="16" alt="Digg"/></a> <a href="http://www.addtoany.com/add_to/facebook?linkurl=http%3A%2F%2Faceontech.com%2F2010%2F01%2F10%2Fflexair-dynamicevent%2F&amp;linkname=Flex%2FAIR%3A%20DynamicEvent" title="Facebook" rel="nofollow" target="_blank"><img src="http://aceontech.com/wp-content/plugins/add-to-any/icons/facebook.png" width="16" height="16" alt="Facebook"/></a> <a href="http://www.addtoany.com/add_to/mixx?linkurl=http%3A%2F%2Faceontech.com%2F2010%2F01%2F10%2Fflexair-dynamicevent%2F&amp;linkname=Flex%2FAIR%3A%20DynamicEvent" title="Mixx" rel="nofollow" target="_blank"><img src="http://aceontech.com/wp-content/plugins/add-to-any/icons/mixx.png" width="16" height="16" alt="Mixx"/></a> <a href="http://www.addtoany.com/add_to/delicious?linkurl=http%3A%2F%2Faceontech.com%2F2010%2F01%2F10%2Fflexair-dynamicevent%2F&amp;linkname=Flex%2FAIR%3A%20DynamicEvent" title="Delicious" rel="nofollow" target="_blank"><img src="http://aceontech.com/wp-content/plugins/add-to-any/icons/delicious.png" width="16" height="16" alt="Delicious"/></a> <a href="http://www.addtoany.com/add_to/reddit?linkurl=http%3A%2F%2Faceontech.com%2F2010%2F01%2F10%2Fflexair-dynamicevent%2F&amp;linkname=Flex%2FAIR%3A%20DynamicEvent" title="Reddit" rel="nofollow" target="_blank"><img src="http://aceontech.com/wp-content/plugins/add-to-any/icons/reddit.png" width="16" height="16" alt="Reddit"/></a> <a href="http://www.addtoany.com/add_to/friendfeed?linkurl=http%3A%2F%2Faceontech.com%2F2010%2F01%2F10%2Fflexair-dynamicevent%2F&amp;linkname=Flex%2FAIR%3A%20DynamicEvent" title="FriendFeed" rel="nofollow" target="_blank"><img src="http://aceontech.com/wp-content/plugins/add-to-any/icons/friendfeed.png" width="16" height="16" alt="FriendFeed"/></a> <a href="http://www.addtoany.com/add_to/google_buzz?linkurl=http%3A%2F%2Faceontech.com%2F2010%2F01%2F10%2Fflexair-dynamicevent%2F&amp;linkname=Flex%2FAIR%3A%20DynamicEvent" title="Google Buzz" rel="nofollow" target="_blank"><img src="http://aceontech.com/wp-content/plugins/add-to-any/icons/google_buzz.png" width="16" height="16" alt="Google Buzz"/></a> <a href="http://www.addtoany.com/add_to/stumbleupon?linkurl=http%3A%2F%2Faceontech.com%2F2010%2F01%2F10%2Fflexair-dynamicevent%2F&amp;linkname=Flex%2FAIR%3A%20DynamicEvent" title="StumbleUpon" rel="nofollow" target="_blank"><img src="http://aceontech.com/wp-content/plugins/add-to-any/icons/stumbleupon.png" width="16" height="16" alt="StumbleUpon"/></a> <a href="http://www.addtoany.com/add_to/evernote?linkurl=http%3A%2F%2Faceontech.com%2F2010%2F01%2F10%2Fflexair-dynamicevent%2F&amp;linkname=Flex%2FAIR%3A%20DynamicEvent" title="Evernote" rel="nofollow" target="_blank"><img src="http://aceontech.com/wp-content/plugins/add-to-any/icons/evernote.png" width="16" height="16" alt="Evernote"/></a> <a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://aceontech.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://aceontech.com/2010/01/10/flexair-dynamicevent/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AS3: How to set focus to an empty textfield</title>
		<link>http://aceontech.com/2009/12/30/as3-how-to-set-focus-to-an-empty-textfield/</link>
		<comments>http://aceontech.com/2009/12/30/as3-how-to-set-focus-to-an-empty-textfield/#comments</comments>
		<pubDate>Wed, 30 Dec 2009 21:41:25 +0000</pubDate>
		<dc:creator>Ace</dc:creator>
				<category><![CDATA[Web Development & Design]]></category>
		<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://aceontech.com/?p=1072</guid>
		<description><![CDATA[Bent your mind over how to set focus to a textfield in ActionScript 3? The solution. <a href="http://aceontech.com/2009/12/30/as3-how-to-set-focus-to-an-empty-textfield/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><strong>Applicable to:</strong> Adobe ActionScript 3, Adobe Flex, Adobe AIR</p>
<p>This simple operation isn&#8217;t very obvious in ActionScript 3. The <code>TextInput</code> element has a boolean property called <code>focusEnabled</code>, but this doesn&#8217;t seem to do anything (it&#8217;s probably meant for other purposes, didn&#8217;t take the time to check).</p>
<p>The way achieve this is two-fold:</p>
<p><code>stage.focus = yourTextField;<br />
yourTextField.setSelection(0,0);</code></p>
<p>If your textfield contains text and you wish to place the caret to the end, you would probably go about it like so:</p>
<p><code>stage.focus = yourTextField;<br />
yourTextField.setSelection(0, yourTextField.length);</code></p>
<p>Makes sense now you know about it, huh?</p>
]]></content:encoded>
			<wfw:commentRss>http://aceontech.com/2009/12/30/as3-how-to-set-focus-to-an-empty-textfield/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
