<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Flexdream's Weblog &#187; AS 3.0</title>
	<atom:link href="http://flexdream.wordpress.com/category/as-30/feed/" rel="self" type="application/rss+xml" />
	<link>http://flexdream.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Fri, 10 Oct 2008 16:02:31 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='flexdream.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/097cffd631d55281da70e7b9e8023300?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Flexdream's Weblog &#187; AS 3.0</title>
		<link>http://flexdream.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://flexdream.wordpress.com/osd.xml" title="Flexdream&#8217;s Weblog" />
		<item>
		<title>Enabling Handcursor on a MovieClip having dynamic TextField in AS3</title>
		<link>http://flexdream.wordpress.com/2008/10/10/enabling-handcursor-on-a-movieclip-having-dynamic-textfield-in-as3/</link>
		<comments>http://flexdream.wordpress.com/2008/10/10/enabling-handcursor-on-a-movieclip-having-dynamic-textfield-in-as3/#comments</comments>
		<pubDate>Fri, 10 Oct 2008 13:08:39 +0000</pubDate>
		<dc:creator>flexdream</dc:creator>
				<category><![CDATA[AS 3.0]]></category>

		<guid isPermaLink="false">http://flexdream.wordpress.com/?p=34</guid>
		<description><![CDATA[
You can enable the hand cursor on a MovieClip by defining the following statement
MovieClip.buttonMode = true;
However the solution does not work in-case you have a dynamic textField in that movieclip. To enable hand in this case you have to additionally write the following statement
MovieClip.mouseChildren = false;
The reason is that the mouseChildren property determines whether or [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=flexdream.wordpress.com&blog=4101566&post=34&subd=flexdream&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><div class="snap_preview">
<p>You can enable the hand cursor on a MovieClip by defining the following statement</p>
<p>MovieClip.buttonMode = true;</p>
<p>However the solution does not work in-case you have a dynamic textField in that movieclip. To enable hand in this case you have to additionally write the following statement</p>
<p>MovieClip.mouseChildren = false;</p>
<p>The reason is that the <strong>mouseChildren</strong> property determines whether or not the children of the object are mouse enabled. If an object is mouse enabled, a user can interact with it by using a mouse. The default is <code>true</code> which makes the dynamic textfield interactable and due to the textfield behaviour the flash player does not show the hand-cursor.</div>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/flexdream.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/flexdream.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/flexdream.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/flexdream.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/flexdream.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/flexdream.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/flexdream.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/flexdream.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/flexdream.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/flexdream.wordpress.com/34/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=flexdream.wordpress.com&blog=4101566&post=34&subd=flexdream&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://flexdream.wordpress.com/2008/10/10/enabling-handcursor-on-a-movieclip-having-dynamic-textfield-in-as3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9c4f63515266e3303f8db93bdbcf3775?s=96&#38;d=identicon" medium="image">
			<media:title type="html">flexdream</media:title>
		</media:content>
	</item>
		<item>
		<title>Attaching MovieClip from library by passing classname as a string in function in AS3</title>
		<link>http://flexdream.wordpress.com/2008/10/10/attaching-movieclip-from-library-by-passing-classname-as-a-string-in-function-in-as3/</link>
		<comments>http://flexdream.wordpress.com/2008/10/10/attaching-movieclip-from-library-by-passing-classname-as-a-string-in-function-in-as3/#comments</comments>
		<pubDate>Fri, 10 Oct 2008 13:07:30 +0000</pubDate>
		<dc:creator>flexdream</dc:creator>
				<category><![CDATA[AS 3.0]]></category>

		<guid isPermaLink="false">http://flexdream.wordpress.com/?p=31</guid>
		<description><![CDATA[The post contains a solution for a case where you need to attach a Library symbol and you have to pass that class name as a string to the function.
The approach followed here is by using the getDefinitionByName utility which interprets the string and convert it into a Class. Then you can use a new [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=flexdream.wordpress.com&blog=4101566&post=31&subd=flexdream&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>The post contains a solution for a case where you need to attach a Library symbol and you have to pass that class name as a string to the function.</p>
<p>The approach followed here is by using the getDefinitionByName utility which interprets the string and convert it into a Class. Then you can use a new syntax with that particular class. Following is a code for the same solution and you can download the source files from <a href="http://www.flexcomps.com/experiments/AttachMovieByFunction.zip">here</a>. The “testMC” here is a movieClip in library with the className as testMC and BaseClass as flash.display.MovieClip<br />
<code><br />
import flash.utils.getDefinitionByName;</code></p>
<p><code><br />
function addMovieFromLibrary(mcIName:String){<br />
var tMC:Class =  getDefinitionByName(mcIName) as Class;<br />
var newMc:MovieClip = new tMC() as MovieClip;<br />
addChild(newMc);<br />
}</code></p>
<p><code><br />
</code></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/flexdream.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/flexdream.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/flexdream.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/flexdream.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/flexdream.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/flexdream.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/flexdream.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/flexdream.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/flexdream.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/flexdream.wordpress.com/31/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=flexdream.wordpress.com&blog=4101566&post=31&subd=flexdream&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://flexdream.wordpress.com/2008/10/10/attaching-movieclip-from-library-by-passing-classname-as-a-string-in-function-in-as3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9c4f63515266e3303f8db93bdbcf3775?s=96&#38;d=identicon" medium="image">
			<media:title type="html">flexdream</media:title>
		</media:content>
	</item>
		<item>
		<title>Trace from the browser, using standard trace()Trace from the browser, using standard trace()</title>
		<link>http://flexdream.wordpress.com/2008/08/22/trace-from-the-browser-using-standard-tracetrace-from-the-browser-using-standard-trace/</link>
		<comments>http://flexdream.wordpress.com/2008/08/22/trace-from-the-browser-using-standard-tracetrace-from-the-browser-using-standard-trace/#comments</comments>
		<pubDate>Fri, 22 Aug 2008 08:46:01 +0000</pubDate>
		<dc:creator>flexdream</dc:creator>
				<category><![CDATA[AS 3.0]]></category>

		<guid isPermaLink="false">http://flexdream.wordpress.com/?p=25</guid>
		<description><![CDATA[Some great 3rd party debug tools have been released in the past few months that expand upon the standard trace() in Flash. I recently wrote about one of them. Unfortunately, I&#8217;ve noticed myself not using these tools as often as I would like because its usually easier and quicker to just use trace(). The biggest [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=flexdream.wordpress.com&blog=4101566&post=25&subd=flexdream&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><div class="step">Some great 3rd party debug tools have been released in the past few months that expand upon the standard trace() in Flash. I recently wrote about <a href="http://www.digitalflipbook.com/archives/2005/04/luminicboxlog_n.php">one of them</a>. Unfortunately, I&#8217;ve noticed myself not using these tools as often as I would like because its usually easier and quicker to just use trace(). The biggest drawback about trace, however, is that there&#8217;s no way to output from the browser &#8230; or is there?</div>
<div class="step">The other day I stumbled upon an <a href="http://www.actionscripts.org/tutorials/beginner/trace_and_debug_from_your_browser/index.shtml" target="_blank">article by Josh Buhler</a> at actionscript.org that shows you how to install the Flash Debug Player that&#8217;s buried in the application folders of Flash. The Debug Player, along with a text file, allows you to view standard traces from a swf in the browser. Now, if you&#8217;ve already read his article skip on down to the bottom of this page because I&#8217;ve added a step that will make you even happier. If you haven&#8217;t read his article yet, go on what are you waiting for? If, on the other hand, you like step-by-step instructions that get you up and running the fastest, I&#8217;ve recapped his process below. I&#8217;ve done this on both the mac and pc and can&#8217;t live without it now.</div>
<div class="step">
<div class="title"><strong>1) Uninstall your Flash Player</strong></div>
<div class="sub">Find the uninstaller here: 		<a href="http://www.adobe.com/support/flashplayer/downloads.html#uninstaller" target="_blank">Adobe Flash Player Uninstallers</a>.</div>
<p>Even though this is the first step, this is the one that you&#8217;re going to question the most, should I really uninstall my Flash Player and install the Debug Player? The answer is an emphatic &#8220;yes&#8221;. The Flash Debug Player is the exact same player with a very nice extra feature.</p></div>
<div class="step">
<div class="title"><strong>2) Install the Flash Debug Player</strong></div>
<p>Find the installer here: 	<a href="http://www.adobe.com/support/flashplayer/downloads.html" target="_blank">Adobe Flash Debug Players</a></div>
<div class="step">
<div class="title"><strong>3) Verify installation of the Flash Debug Player</strong></div>
<p>Restart your browser and right-click (ctrl-click) on a swf. 	You should have the &#8220;Debugger&#8221; option in the context menu, like the example below. 	<img class="block_image" src="http://www.digitalflipbook.com/mt/images/debugger.gif" border="1" alt="Flash Debug Player" width="192" height="86" /></div>
<div class="step">
<div class="title"><strong>4a) Create a text file named &#8220;mm.cfg&#8221;</strong></div>
<p>Save the file here:</p>
<div class="platform"><strong>OSX -</strong></div>
<div class="sub"><em>MacHD</em>:Library:Application Support:Macromedia:mm.cfg</div>
<div class="platform"><strong>Windows XP -</strong></div>
<div class="sub">C:\Documents and Settings\<em>username</em>\mm.cfg</div>
<div class="platform"><strong>Windows 2000 -</strong></div>
<div class="sub">C:\mm.cfg</div>
<div class="platform"><strong>Linux -</strong></div>
<div class="sub">home/<em>username</em>/mm.cfg</div>
</div>
<div class="step">
<div class="title"><strong>4b) Add properties to mm.cfg</strong></div>
<div class="sub">ErrorReportingEnable=0</div>
<div class="sub">TraceOutputFileEnable=1</div>
<div class="sub">MaxWarnings=0</div>
</div>
<div class="new_step"><strong>FLASH DEBUG PLAYERS 9,0,28,0 AND NEWER</strong></div>
<div class="step">
<div class="title"><strong>4c) The property <em>TraceOutputFileName</em> is no longer needed in mm.cfg. The default location of flashlog.txt has changed and cannot be modified from the following locations:</strong></div>
<div class="platform"><strong>OSX -</strong></div>
<div class="sub"><em>MacHD</em>:Users:<em>username</em>:Library:Preferences:Macromedia:Flash Player:Logs:flashlog.txt</div>
<div class="platform"><strong>Windows -</strong></div>
<div class="sub">C:\Documents and Settings\<em>username</em>\Application Data\Macromedia\Flash Player\Logs\flashlog.txt</div>
<div class="platform"><strong>Linux -</strong></div>
<div class="sub">home/<em>username</em>/Macromedia/Flash_Player/Logs/flashlog.txt</div>
</div>
<div class="new_step"><strong>FLASH DEBUG PLAYERS 9,0,16,0 AND OLDER</strong></div>
<div class="step">
<div class="title"><strong>4c) Add the property <em>TraceOutputFileName</em> to mm.cfg</strong></div>
<div class="platform"><strong>OSX -</strong></div>
<div class="sub">TraceOutputFileName=<em>MacHD</em>:Users:<em>username</em> <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> esktop:flashlog.txt</div>
<div class="platform"><strong>Windows -</strong></div>
<div class="sub">TraceOutputFileName=C:\Documents and Settings\<em>username</em>\Desktop\flashlog.txt</div>
</div>
<div class="new_step"><strong>ALL FLASH DEBUG PLAYERS</strong></div>
<div class="step">
<div class="title"><strong>5) Test the Flash Debug Player</strong></div>
<p>Either publish a swf that uses trace() and view it in the browser, or surf around and find out what other people have been tracing in their movies (that&#8217;s one of my favorite options). The traces have been output from the browser to the text file. Open up flashlog.txt and see for yourself, you know you want to.</p></div>
<div class="step">And there you go. I&#8217;m sure many of you are extremely happy right now, and you should be, this is a great tip. But after a few uses, you&#8217;re going to get really annoyed opening and closing the text file to view the new traces &#8230; if only there was a way to view the text file being updated in real time like the Output window in Flash. Here&#8217;s the new step that will make you rejoice.</div>
<div class="new_step"><strong>NEW STEP &#8230;</strong></div>
<div class="step">
<div class="title"><strong>6) View the text file updating in real time</strong></div>
<div class="platform"><strong>OSX -</strong></div>
<div class="sub">Open Terminal</div>
<div class="sub">At the prompt type:</div>
<div class="sub">&gt;&gt; cd <em>&lt;path to flashlog&#8217;s directory&gt;</em></div>
<div class="sub">&gt;&gt; tail -f flashlog.txt</div>
<div class="platform"><strong>Windows -</strong></div>
<div class="sub">Go to <a href="http://www.microsoft.com/technet/downloads/winsrvr/tools/default.mspx" target="_blank">Windows Server 2003 Tools</a>, and download <em>Windows Server 2003 Resource Kit Tools</em> near the bottom of the page. 		Although it says Windows Server 2003 all over the page, its also made for Windows XP.</div>
<div class="sub">Install</div>
<div class="sub">Open Command Prompt</div>
<div class="sub">At the prompt type:</div>
<div class="sub">&gt; cd <em>&lt;path to flashlog&#8217;s directory&gt;</em></div>
<div class="sub">&gt; tail -f flashlog.txt</div>
</div>
<div class="step">Browse to a swf online that uses trace() and watch the magic. Terminal and Command Prompt display the contents of flashlog.txt as it changes &#8230; its just like having Flash&#8217;s Output window, except this one works in the browser!!</div>
<div class="step">Isn&#8217;t this great? Like I said earlier, I&#8217;ve gotten this to work on both the mac and the pc and can&#8217;t live without it now. 	If you have any questions about these steps, feel free to email me or comment below and I&#8217;ll be glad to help.</div>
<div class="new_step"><strong>OPTIONAL WINDOWS STEPS &#8230;</strong></div>
<div class="step">
<div class="title"><strong>7) Create a batch file to quickly load up the flashlog in tail</strong></div>
<div class="sub">Create a text file and rename it flashlog.bat</div>
<div class="sub">Right-click on the batch file and select &#8220;Edit&#8221;</div>
<div class="sub">Add the following content to flashlog.bat:<br />
cd <em>&lt;path to flashlog&#8217;s directory&gt;</em><br />
tail -f flashlog.txt</div>
</div>
<div class="step">Double-click on the batch file to see it working.</div>
<div class="step">
<div class="title"><strong> <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /> Create a shortcut to the batch file to set the Command Prompt colors and options</strong></div>
<div class="sub">Right-click on the batch file and select &#8220;Create Shortcut&#8221;</div>
<div class="sub">Right-click on the shortcut and select &#8220;Properties&#8221;</div>
<div class="sub">To view the Command Prompt maximized change the pulldown under &#8220;Run:&#8221;<br />
To change the colors of the Command Prompt select the &#8220;Colors&#8221; tab<br />
Unfortunately the &#8220;Font&#8221; tab options are very limited<br />
Under the &#8220;Options&#8221; tab, select &#8220;QuickEdit mode&#8221; to be able to easily select and copy and paste<br />
Tip for copying and pasting in the Command Prompt:<br />
Select the text you want to copy and then right-click it, this puts the selected text into the clipboard &#8230; now just hit ctrl-v or paste in any other program.</div>
</div>
<p>Close out of the properties and double-click on the shortcut to see the flashlog with your colors and options.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/flexdream.wordpress.com/25/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/flexdream.wordpress.com/25/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/flexdream.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/flexdream.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/flexdream.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/flexdream.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/flexdream.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/flexdream.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/flexdream.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/flexdream.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/flexdream.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/flexdream.wordpress.com/25/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=flexdream.wordpress.com&blog=4101566&post=25&subd=flexdream&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://flexdream.wordpress.com/2008/08/22/trace-from-the-browser-using-standard-tracetrace-from-the-browser-using-standard-trace/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9c4f63515266e3303f8db93bdbcf3775?s=96&#38;d=identicon" medium="image">
			<media:title type="html">flexdream</media:title>
		</media:content>

		<media:content url="http://www.digitalflipbook.com/mt/images/debugger.gif" medium="image">
			<media:title type="html">Flash Debug Player</media:title>
		</media:content>
	</item>
		<item>
		<title>MXML ActionScript Classes</title>
		<link>http://flexdream.wordpress.com/2008/08/10/mxml-actionscript-classes/</link>
		<comments>http://flexdream.wordpress.com/2008/08/10/mxml-actionscript-classes/#comments</comments>
		<pubDate>Sun, 10 Aug 2008 14:44:08 +0000</pubDate>
		<dc:creator>flexdream</dc:creator>
				<category><![CDATA[AS 3.0]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://flexdream.wordpress.com/?p=20</guid>
		<description><![CDATA[

As you know, all MXML files are converted to ActionScript Classes which are later compiled in SWF file. If you want to view / study these automatically generated classes, you can use Compiler Argument -keep-generated-actionscript in Flex Builder Project.
In Flex Builder navigate to Project &#62; Properties &#62; Flex Compiler &#62; Additional compiler arguments and add [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=flexdream.wordpress.com&blog=4101566&post=20&subd=flexdream&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><div class="entry">
<div class="snap_preview">
<p class="MsoNormal">As you know, all MXML files are converted to ActionScript Classes which are later compiled in SWF file. If you want to view / study these automatically generated classes, you can use Compiler Argument -keep-generated-actionscript in Flex Builder Project.</p>
<p class="MsoNormal">In Flex Builder navigate to Project &gt; Properties &gt; Flex Compiler &gt; Additional compiler arguments and add following configuration: <strong>-keep-generated-actionscript</strong></p>
<p class="MsoNormal">This will create a folder named generated in project source folder which will have all ActionScript classes which Flex Builder automatically generates from MXML ({MXML file name}-generated).</p>
</div>
</div>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/flexdream.wordpress.com/20/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/flexdream.wordpress.com/20/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/flexdream.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/flexdream.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/flexdream.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/flexdream.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/flexdream.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/flexdream.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/flexdream.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/flexdream.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/flexdream.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/flexdream.wordpress.com/20/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=flexdream.wordpress.com&blog=4101566&post=20&subd=flexdream&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://flexdream.wordpress.com/2008/08/10/mxml-actionscript-classes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9c4f63515266e3303f8db93bdbcf3775?s=96&#38;d=identicon" medium="image">
			<media:title type="html">flexdream</media:title>
		</media:content>
	</item>
		<item>
		<title>Copying objects with Flash.utils.ByteArray</title>
		<link>http://flexdream.wordpress.com/2008/07/17/copying-objects-with-flashutilsbytearray/</link>
		<comments>http://flexdream.wordpress.com/2008/07/17/copying-objects-with-flashutilsbytearray/#comments</comments>
		<pubDate>Thu, 17 Jul 2008 09:24:04 +0000</pubDate>
		<dc:creator>flexdream</dc:creator>
				<category><![CDATA[AS 3.0]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://flexdream.wordpress.com/?p=14</guid>
		<description><![CDATA[I have been exploring the ways to copy an Array object to a new Array with less of the effort. Reason being the following statements in ActionScript
var arrayA:Array = new Array(”Jack”,”Steve”,”Mark”,”Ted”);
var arrayB:Array = arrayA;

The above statements appears to create a copy of arrayA, however in the actual it creates a new reference to the arrayA [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=flexdream.wordpress.com&blog=4101566&post=14&subd=flexdream&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I have been exploring the ways to copy an Array object to a new Array with less of the effort. Reason being the following statements in ActionScript</p>
<p><em>var arrayA:Array = new Array(”Jack”,”Steve”,”Mark”,”Ted”);<br />
var arrayB:Array = arrayA;<br />
</em></p>
<p>The above statements appears to create a copy of <em>arrayA</em>, however in the actual it creates a new reference to the <em>arrayA</em> object. The problem is that if you execute any operation on <em>arrayB</em> object now it will impact the <em>arrayA</em> eventually. For example:</p>
<p><em>arrayB.pop();<br />
trace(arrayA);</em></p>
<p>The statement is supposed to trace “Jack,Steve,Mark,Ted” whereas it will trace “Jack,Steve,Mark”.</p>
<p>To overcome this problem we use the following methodology</p>
<p><em>var arrayA:Array = new Array(”Jack”,”Steve”,”Mark”,”Ted”);<br />
var arrayB:Array = new Array();<br />
for(var i:int = 0; i &lt; arrayA.length; i++) {<br />
arrayB[i] = arrayA[i];</em><em></em></p>
<p><em>}<br />
arrayB.pop();<br />
trace(arrayA);</em></p>
<p>Now it will trace the desired result i.e. “Jack,Steve,Mark,Ted” and if you trace <em>arrayB</em> then it will trace “jack,Steve,Mark”</p>
<p>This methodology is very good when you are dealing with single array objects but when it comes to Nested Arrays it is really a tedious job as you have to look for every inner object of an array if it is an Array type and then again create a new array and copy it’s element. To overcome this we can use now the <strong>ByteArray</strong> class of <em>Flash.utils</em> package</p>
<p>You can review the following code used to copy an array. There is a disadvantages of using the ByteArray and that is you will loose on some speed. The ByteArray.Read method is slower than copying an Array. You can see a benchmark here</p>
<p>——————————–<br />
Copying a 100000 elements array<br />
——————————–<br />
Copy with loops starts at :: 802504163<br />
Copy with loop ends at :: 802504210<br />
<strong>Time elapsed :: 47 milliseconds</strong><br />
Copy with ByteArray Starts at :: 802504257<br />
Copy with Byte Array :: 802504382<br />
<strong>Time elapsed :: 125 milliseconds</strong></p>
<p>There is certainly a significant amount of processing time which ByteArray take however it is eventually helping us out when it comes to copying nested objects.</p>
<p>Download the fla from <a title="Source Fla" href="http://www.flexcomps.com/experiments/ByteArrayCopy.zip" target="_blank">here</a>.</p>
<p>Here is the code for the same.</p>
<p>——————————————————–</p>
<p>——————————————————–</p>
<blockquote><p><span style="color:#0000ff;">import </span>flash.utils.ByteArray;</p>
<p>var tDate:Date = new Date();<br />
var iStartTime:uint;<br />
var iTime:uint;<br />
var byteArray:ByteArray = new ByteArray();</p>
<p>trace(”——————————–”);<br />
trace(”Copying a 100000 elements array “);<br />
trace(”——————————–”);<br />
//———- Create and Populate Array ———<br />
var arrayA:Array = new Array();<br />
for (var i:uint; i&lt;=100000; i++) {<br />
arrayA.push(Math.random()*i);<br />
if (i == 100000) {<br />
copyArray();<br />
}<br />
}</p>
<p>//———– Copy Array using Loops ——–</p>
<p>function copyArray():void {<br />
tDate = new Date();<br />
iStartTime = tDate.time;<br />
trace(”Copy with loops starts at :: ” + iStartTime);<br />
var arrayB:Array = new Array();<br />
var arr_len:uint = arrayA.length -1;<br />
for (var i:int = 0; i &lt;= arr_len; i++) {<br />
arrayB[i] = arrayA[i];<br />
if (i == arr_len) {<br />
tDate = new Date();<br />
iTime = tDate.time;<br />
trace(”Copy with loop ends at :: ” + iTime);<br />
trace(”Time elapsed :: ” + (iTime &#8211; iStartTime) + ” milliseconds”);<br />
copyWithByteArray();<br />
}<br />
}<br />
}<br />
//——- Function copy with Byte Array ———<br />
function copyWithByteArray():void {<br />
tDate = new Date();<br />
iTime = tDate.time;<br />
trace(”Copy with ByteArray Starts at :: ” + iTime);<br />
byteArray.writeObject(arrayA);<br />
byteArray.position = 0;<br />
var arrayB:Array = byteArray.readObject() as Array;<br />
tDate = new Date();<br />
var iByteArrTime:uint = tDate.time;<br />
trace(”Copy with Byte Array :: ” + iByteArrTime);<br />
trace(”Time elapsed :: ” + (iByteArrTime &#8211; iTime) + ” milliseconds”);<br />
}</p></blockquote>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/flexdream.wordpress.com/14/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/flexdream.wordpress.com/14/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/flexdream.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/flexdream.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/flexdream.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/flexdream.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/flexdream.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/flexdream.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/flexdream.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/flexdream.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/flexdream.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/flexdream.wordpress.com/14/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=flexdream.wordpress.com&blog=4101566&post=14&subd=flexdream&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://flexdream.wordpress.com/2008/07/17/copying-objects-with-flashutilsbytearray/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9c4f63515266e3303f8db93bdbcf3775?s=96&#38;d=identicon" medium="image">
			<media:title type="html">flexdream</media:title>
		</media:content>
	</item>
		<item>
		<title>Resizing button component on the fly</title>
		<link>http://flexdream.wordpress.com/2008/07/09/resizing-button-component-on-the-fly/</link>
		<comments>http://flexdream.wordpress.com/2008/07/09/resizing-button-component-on-the-fly/#comments</comments>
		<pubDate>Wed, 09 Jul 2008 10:04:17 +0000</pubDate>
		<dc:creator>flexdream</dc:creator>
				<category><![CDATA[AS 3.0]]></category>

		<guid isPermaLink="false">http://flexdream.wordpress.com/?p=8</guid>
		<description><![CDATA[We have encountered a situation where the the UI button label was changing frequently in Flash CS3. So basis on that we have to resize our button component as the label changes. There is no inbuilt AutoResize feature in button component so what we have done is, get the size of the label and then [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=flexdream.wordpress.com&blog=4101566&post=8&subd=flexdream&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>We have encountered a situation where the the UI button label was changing frequently in Flash CS3. So basis on that we have to resize our button component as the label changes. There is no inbuilt AutoResize feature in button component so what we have done is, get the size of the label and then set the width of the button. Following is the code we have implemented in this case. Put a UI button on stage and name it “_btn”. You can download the source files from <a title="Resize button source" href="http://www.flexcomps.com/experiments/ResizeBtn.zip" target="_blank">here</a>.</p>
<p><em>import flash.events.Event;</em><br />
<em> //———-<br />
var t_arr:Array = ["This is string 1","Hello","Hello to String 3","Hello to String 4","Hello to String 5","This is a long string NOW "];<br />
//——— Set the button textfield properties ———-<br />
_btn.textField.autoSize = TextFieldAutoSize.LEFT;  // We need to set the autosize to LEFT?RIGHT or CENTER instead of NONE<br />
_btn.textField.multiline = false;       // Make sure the multiline is false in this case to get proper dimensions<br />
_btn.label = t_arr[0];<br />
_btn.textField.addEventListener(Event.RENDER,resizeBtn);    // Add an event listener to textfield on render event<br />
_btn.addEventListener(MouseEvent.CLICK,clickHandler);<br />
//——–  Resize the button ———–<br />
function resizeBtn(evt:Event):void{<br />
//	trace(evt.target.width+”   “+evt.target.parent.width);<br />
_btn.width = evt.target.width+5;<br />
_btn.validateNow();</em></p>
<p><em>}<br />
//———— Handle button click ———<br />
function clickHandler(evt:MouseEvent):void{<br />
_btn.label = t_arr[Math.floor(6*Math.random())];<br />
}</em></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/flexdream.wordpress.com/8/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/flexdream.wordpress.com/8/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/flexdream.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/flexdream.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/flexdream.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/flexdream.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/flexdream.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/flexdream.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/flexdream.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/flexdream.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/flexdream.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/flexdream.wordpress.com/8/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=flexdream.wordpress.com&blog=4101566&post=8&subd=flexdream&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://flexdream.wordpress.com/2008/07/09/resizing-button-component-on-the-fly/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9c4f63515266e3303f8db93bdbcf3775?s=96&#38;d=identicon" medium="image">
			<media:title type="html">flexdream</media:title>
		</media:content>
	</item>
		<item>
		<title>Loading library assets from flash9 swf to Flex</title>
		<link>http://flexdream.wordpress.com/2008/07/09/loading-library-assets-from-flash9-swf-to-flex/</link>
		<comments>http://flexdream.wordpress.com/2008/07/09/loading-library-assets-from-flash9-swf-to-flex/#comments</comments>
		<pubDate>Wed, 09 Jul 2008 09:48:01 +0000</pubDate>
		<dc:creator>flexdream</dc:creator>
				<category><![CDATA[AS 3.0]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://flexdream.wordpress.com/?p=7</guid>
		<description><![CDATA[This is a prototype to load external flash9 swf file into flex and using the library items from the swf. In given example we have two library symbols with linkage ids (”mc1″, “mc2″).
Just make sure when you create a movieclip from these definitions, you firstly add these to a UIComponent and then that component to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=flexdream.wordpress.com&blog=4101566&post=7&subd=flexdream&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>This is a prototype to load external flash9 swf file into flex and using the library items from the swf. In given example we have two library symbols with linkage ids (”mc1″, “mc2″).</p>
<p>Just make sure when you create a movieclip from these definitions, you firstly add these to a UIComponent and then that component to stage or any container, otherwise there will be a conversion error you will be getting</p>
<p>You can download sources from <a href="http://www.flexcomps.com/experiments/LoadLib.zip" target="_blank">here</a></p>
<p>Following is the code for the same.</p>
<p>&lt;?xml version=”1.0″ encoding=”utf-8″?&gt;</p>
<p>&lt;mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml” creationComplete=”init()” layout=”absolute”&gt;</p>
<p>&lt;mx:Script&gt;</p>
<p>&lt;![CDATA[</p>
<p><strong>import</strong> mx.core.UIComponent;</p>
<p><em>//-------- Declare Variables --------</em></p>
<p><strong>private</strong> <strong>var</strong> swfLoader:Loader;</p>
<p><strong>private</strong> <strong>var</strong> fileURL:URLRequest;</p>
<p><em>//----- Initialize Function ------------</em></p>
<p><strong>private</strong> <strong>function</strong> init():<strong>void</strong>{</p>
<p><em>//    Security.allowDomain("*");</em></p>
<p>swfLoader = <strong>new</strong> Loader();</p>
<p>_fileURL = <strong>new</strong> URLRequest(<strong>"sample.swf"</strong>);</p>
<p>configureListeners(swfLoader.contentLoaderInfo);</p>
<p><strong>try</strong>{</p>
<p>swfLoader.load(_fileURL);</p>
<p>}</p>
<p><strong>catch</strong>(e:IOErrorEvent){</p>
<p><strong>trace</strong>(e.toString());</p>
<p>}</p>
<p>}</p>
<p><strong>private</strong> <strong>function</strong> configureListeners(dispatcher:IEventDispatcher):<strong>void</strong> {</p>
<p>dispatcher.addEventListener(Event.COMPLETE, onSWFLoaded);</p>
<p>dispatcher.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);</p>
<p>dispatcher.addEventListener(Event.INIT, initHandler);</p>
<p>dispatcher.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);</p>
<p>dispatcher.addEventListener(Event.OPEN, openHandler);</p>
<p>dispatcher.addEventListener(ProgressEvent.PROGRESS, progressHandler);</p>
<p>dispatcher.addEventListener(Event.UNLOAD, unLoadHandler);</p>
<p>}</p>
<p><strong>private</strong> <strong>function</strong> completeHandler(event:Event):<strong>void</strong> {</p>
<p><strong>trace</strong>(<strong>"completeHandler: "</strong> + event);</p>
<p>}</p>
<p><strong>private</strong> <strong>function</strong> httpStatusHandler(event:HTTPStatusEvent):<strong>void</strong> {</p>
<p><strong>trace</strong>(<strong>"httpStatusHandler: "</strong> + event);</p>
<p>}</p>
<p><strong>private</strong> <strong>function</strong> initHandler(event:Event):<strong>void</strong> {</p>
<p><strong>trace</strong>(<strong>"initHandler: "</strong> + event);</p>
<p>}</p>
<p><strong>private</strong> <strong>function</strong> ioErrorHandler(event:IOErrorEvent):<strong>void</strong> {</p>
<p><strong>trace</strong>(<strong>"ioErrorHandler: "</strong> + event);</p>
<p>}</p>
<p><strong>private</strong> <strong>function</strong> openHandler(event:Event):<strong>void</strong> {</p>
<p><strong>trace</strong>(<strong>"openHandler: "</strong> + event);</p>
<p>}</p>
<p><strong>private</strong> <strong>function</strong> progressHandler(event:ProgressEvent):<strong>void</strong> {</p>
<p><strong>trace</strong>(<strong>"progressHandler: bytesLoaded="</strong> + event.bytesLoaded + <strong>" bytesTotal="</strong> + event.bytesTotal);</p>
<p>}</p>
<p><strong>private</strong> <strong>function</strong> unLoadHandler(event:Event):<strong>void</strong> {</p>
<p><strong>trace</strong>(<strong>"unLoadHandler: "</strong> + event);</p>
<p>}</p>
<p><em>//-----</em></p>
<p><strong>private</strong> <strong>function</strong> onSWFLoaded(event:Event):<strong>void</strong>{</p>
<p><strong>var</strong> mClip:Class = event.target.applicationDomain.getDefinition(<strong>"mc1"</strong>) <strong>as</strong> Class;</p>
<p><strong>var</strong> mClip1:Class = event.target.applicationDomain.getDefinition(<strong>"mc2"</strong>) <strong>as</strong> Class;</p>
<p><strong>var</strong> mClipInstance:MovieClip = <strong>new</strong> mClip() <strong>as</strong> MovieClip;</p>
<p><strong>var</strong> mClipInstance1:MovieClip = <strong>new</strong> mClip1() <strong>as</strong> MovieClip;</p>
<p><em>//trace(mClipInstance.totalFrames);</em></p>
<p><strong>var</strong> uiComp:UIComponent = <strong>new</strong> UIComponent();</p>
<p>uiComp.addChild(mClipInstance);</p>
<p>uiComp.addChild(mClipInstance1);</p>
<p>addChild(uiComp);</p>
<p>uiComp.x = 100;</p>
<p>uiComp.y = 100;</p>
<p>uiComp.getChildAt(0).x = 150;</p>
<p>}</p>
<p>]]&gt;</p>
<p>&lt;/mx:Script&gt;</p>
<p>&lt;/mx:Application&gt;</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/flexdream.wordpress.com/7/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/flexdream.wordpress.com/7/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/flexdream.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/flexdream.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/flexdream.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/flexdream.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/flexdream.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/flexdream.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/flexdream.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/flexdream.wordpress.com/7/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/flexdream.wordpress.com/7/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/flexdream.wordpress.com/7/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=flexdream.wordpress.com&blog=4101566&post=7&subd=flexdream&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://flexdream.wordpress.com/2008/07/09/loading-library-assets-from-flash9-swf-to-flex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9c4f63515266e3303f8db93bdbcf3775?s=96&#38;d=identicon" medium="image">
			<media:title type="html">flexdream</media:title>
		</media:content>
	</item>
	</channel>
</rss>