<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>flash cs</title>
	
	<link>http://www.flashcs.org</link>
	<description>flash experiments, tutorials, code and news</description>
	<lastBuildDate>Sat, 11 Jul 2009 08:50:14 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/FlashCs" type="application/rss+xml" /><item>
		<title>5005: Unknown error optimizing byte code and “You cannot debug this SWF because it does not contain ActionScript”</title>
		<link>http://feedproxy.google.com/~r/FlashCs/~3/RohF5e8h_Po/</link>
		<comments>http://www.flashcs.org/5005-unknown-error-optimizing-byte-code-and-you-cannot-debug-this-swf-because-it-does-not-contain-actionscript/#comments</comments>
		<pubDate>Mon, 09 Feb 2009 15:52:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flash CS]]></category>
		<category><![CDATA[How to]]></category>
		<category><![CDATA[5005]]></category>
		<category><![CDATA[CS4]]></category>
		<category><![CDATA[error]]></category>

		<guid isPermaLink="false">http://www.flashcs.org/?p=59</guid>
		<description><![CDATA[So it would turn out that flash CS4 cannot handle large projects out of the box. It took me a while to find the solution that is why I am republishing. This fix was originally posted on negush Their post was originally about fixing the 5005: Unknown error optimizing byte code.  But what I found [...]]]></description>
			<content:encoded><![CDATA[<p>So it would turn out that flash CS4 cannot handle large projects out of the box. It took me a while to find the solution that is why I am republishing. This fix was originally posted on <a href="http://www.negush.net/blog/5005-unknown-error-optimizing-byte-code/">negush</a> Their post was originally about fixing the <em>5005: Unknown error optimizing byte code</em>.  But what I found out later after swapping to a new macihine is that the fix below also fixes the &#8220;You cannot debug this SWF because it does not contain ActionScript&#8221;. What I think happens is the compiler runs out of memory in a big project and instead of erroring shows you the stuipid non helpful error.</p>
<p>But the fix below should solve the two issues (5005: Unknown error optimizing byte code  <em>and</em> You cannot debug this SWF because it does not contain ActionScript)</p>
<p><strong>Fix &#8211; windows</strong></p>
<p>my computer -&gt; properties -&gt; advanced -&gt; environment vars -&gt;    then make a new var like this</p>
<p>JAVA_TOOL_OPTIONS</p>
<p>and its value</p>
<p>-Xmx128M     or       -Xmx256M</p>
<p><strong>Fix &#8211; Mac:</strong> Nod to Liquidweaver who posted this in the <a href="http://www.flashcs.org/5005-unknown-error-optimizing-byte-code-and-you-cannot-debug-this-swf-because-it-does-not-contain-actionscript/comment-page-1/#comment-636" target="_self">comments</a></p>
<p>you have to add a value to the environment.plist:<br />
JAVA_TOOL_OPTIONS<br />
-Xmx1024</p>
<p>if you don’t have this file, you can create it here:<br />
~/.MacOSX/environment.plist<br />
where ~ is your home dir, and you may have to create both the directory and the file; please refer to Apple’s documentation on plist creation:<br />
<a rel="nofollow" href="http://developer.apple.com/qa/qa2001/qa1067.html">http://developer.apple.com/qa/qa2001/qa1067.html</a></p>
<p>You will need to log out and then back in for this to take affect…</p>
<p>!!!AND!!!</p>
<p>YOU CANNOT RUN FLASH FROM SPOTLIGHT</p>
<p>For some reason, Spotlight ignores the environment.plist options; I’ve logged an issue with Apple regarding this shortcoming.</p>
<p>Another solution on the web is to delete the .aso files generated by Flash (Control -&gt; Delete ASO Files) .</p>
<span class="akst_link"><a href="http://www.flashcs.org/?p=59&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_59"  class="akst_share_link">Share This</a>
</span><div class="feedflare">
<a href="http://feeds.feedburner.com/~f/FlashCs?a=SsrMMtzk"><img src="http://feeds.feedburner.com/~f/FlashCs?d=41" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=zc6Y3SWU"><img src="http://feeds.feedburner.com/~f/FlashCs?d=50" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=Yf171GhY"><img src="http://feeds.feedburner.com/~f/FlashCs?i=Yf171GhY" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=OhfaOtiQ"><img src="http://feeds.feedburner.com/~f/FlashCs?d=52" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=SnqGkVle"><img src="http://feeds.feedburner.com/~f/FlashCs?d=54" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=rEKziem8"><img src="http://feeds.feedburner.com/~f/FlashCs?i=rEKziem8" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/FlashCs/~4/RohF5e8h_Po" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.flashcs.org/5005-unknown-error-optimizing-byte-code-and-you-cannot-debug-this-swf-because-it-does-not-contain-actionscript/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		<feedburner:origLink>http://www.flashcs.org/5005-unknown-error-optimizing-byte-code-and-you-cannot-debug-this-swf-because-it-does-not-contain-actionscript/</feedburner:origLink></item>
		<item>
		<title>Random Number within a range</title>
		<link>http://feedproxy.google.com/~r/FlashCs/~3/jBqexcAwjgc/</link>
		<comments>http://www.flashcs.org/random-number-within-a-range/#comments</comments>
		<pubDate>Mon, 26 Jan 2009 11:41:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AS2]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Snippet]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[random number within a range]]></category>
		<category><![CDATA[Randon]]></category>
		<category><![CDATA[range]]></category>

		<guid isPermaLink="false">http://www.flashcs.org/?p=51</guid>
		<description><![CDATA[This is a simple function that returns a random value within a range.

function randomNumber&#40;rangeMax:int = 1, rangeMin:int = 0&#41;:int
&#123;
	return Math.round&#40;Math.random&#40;&#41; * &#40;rangeMax - rangeMin&#41; + rangeMin&#41;;
&#125;
&#160;
 trace&#40;randomNumber&#40;13, -3&#41;&#41;; // Returns a random number between -3 and 13.
 trace&#40;randomNumber&#40;50&#41;&#41;;  // Returns a random number between 0 and 50.
 trace&#40;randomNumber&#40;&#41;&#41;; // Returns 0 or 1 as [...]]]></description>
			<content:encoded><![CDATA[<p>This is a simple function that returns a random value within a range.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #339966; font-weight: bold;">function</span> randomNumber<span style="color: #000000;">&#40;</span>rangeMax<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span> = <span style="color: #000000; font-weight:bold;">1</span>, rangeMin<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">return</span> <span style="color: #004993;">Math</span>.<span style="color: #004993;">round</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Math</span>.<span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000;">&#40;</span>rangeMax <span style="color: #000000; font-weight: bold;">-</span> rangeMin<span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">+</span> rangeMin<span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span>
&nbsp;
 <span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>randomNumber<span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">13</span>, <span style="color: #000000; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">3</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>; <span style="color: #009900;">// Returns a random number between -3 and 13.</span>
 <span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>randomNumber<span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">50</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;  <span style="color: #009900;">// Returns a random number between 0 and 50.</span>
 <span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>randomNumber<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>; <span style="color: #009900;">// Returns 0 or 1 as random number.</span></pre></div></div>

<p><script type="text/javascript"><!--
url_site = 'http://www.flashcs.org/random-number-within-a-range/';
// --></script><br />
<script src="http://www.wscoop.com/sites/all/modules/drigg_external/js/button.js" type="text/javascript"></script></p>
<span class="akst_link"><a href="http://www.flashcs.org/?p=51&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_51"  class="akst_share_link">Share This</a>
</span><div class="feedflare">
<a href="http://feeds.feedburner.com/~f/FlashCs?a=rd5ENMu9"><img src="http://feeds.feedburner.com/~f/FlashCs?d=41" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=pHZqXY0u"><img src="http://feeds.feedburner.com/~f/FlashCs?d=50" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=C64N7zrk"><img src="http://feeds.feedburner.com/~f/FlashCs?i=C64N7zrk" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=lg9pGFhA"><img src="http://feeds.feedburner.com/~f/FlashCs?d=52" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=DnQswsMP"><img src="http://feeds.feedburner.com/~f/FlashCs?d=54" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=a5clbn5l"><img src="http://feeds.feedburner.com/~f/FlashCs?i=a5clbn5l" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/FlashCs/~4/jBqexcAwjgc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.flashcs.org/random-number-within-a-range/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.flashcs.org/random-number-within-a-range/</feedburner:origLink></item>
		<item>
		<title>Globals in AS3</title>
		<link>http://feedproxy.google.com/~r/FlashCs/~3/oRIzCabSiGw/</link>
		<comments>http://www.flashcs.org/globals-in-as3/#comments</comments>
		<pubDate>Thu, 22 Jan 2009 11:12:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Global]]></category>

		<guid isPermaLink="false">http://www.flashcs.org/?p=45</guid>
		<description><![CDATA[So as we all know in AS3 there is not such thing as _root or globals.
But sometimes you just really want and need global vars, so what to do.
Well never fear Paulius Uza has created a global class.
Global Object is a Singleton that lets you store dynamic variables in a globally accessible location within your [...]]]></description>
			<content:encoded><![CDATA[<p>So as we all know in AS3 there is not such thing as _root or globals.</p>
<p>But sometimes you just really want and need global vars, so what to do.</p>
<p>Well never fear Paulius Uza has created a <a href="http://www.uza.lt/codex/as3-global-object/">global class.</a></p>
<blockquote><p>Global Object is a Singleton that lets you store dynamic variables in a globally accessible location within your AS3 application. This enables developers to accomplish things like self registering visual components, global events and event listeners.</p></blockquote>
<p>I have used this class in many projects and found it great. Using it is simple see the example below</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span>  <span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span>.<span style="color: #000000; font-weight: bold;">*</span>;
	<span style="color: #0033ff; font-weight: bold;">import</span> lt.uza.utils.<span style="color: #000000; font-weight: bold;">*</span>;
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> Test extends <span style="color: #004993;">Sprite</span>
	<span style="color: #000000;">&#123;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">global</span><span style="color: #000000; font-weight: bold;">:</span>Global = Global.getInstance<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> testSprite<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Sprite</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Sprite</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> Test<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>
			<span style="color: #009900;">//setting variables is easy, global object accepts any name / value pair, even functions</span>
			<span style="color: #004993;">global</span>.<span style="color: #004993;">stage</span> = <span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">stage</span>;
			<span style="color: #004993;">global</span>.testA = <span style="color: #990000;">&quot;a&quot;</span>
			<span style="color: #004993;">global</span>.testB = testSprite;
					<span style="color: #004993;">global</span>.testF = <span style="color: #004993;">test</span>;
					<span style="color: #009900;">//getting variables is easy too</span>
					<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">global</span>.testA<span style="color: #000000;">&#41;</span>;
					<span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>testB<span style="color: #000000;">&#41;</span>;
					<span style="color: #009900;">//as easy as calling a globally stored function</span>
					<span style="color: #004993;">global</span>.testF<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">test</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
				<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;this is a global test&quot;</span><span style="color: #000000;">&#41;</span>;
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p><a href="http://www.uza.lt/codex/as3-global-object/">Click here to find out more</a> and download the class</p>
<p><script type="text/javascript">
url_site = 'http://www.flashcs.org/globals-in-as3/'; </script><br />
<script src="http://www.wscoop.com/sites/all/modules/drigg_external/js/button.js" type="text/javascript"></script></p>
<span class="akst_link"><a href="http://www.flashcs.org/?p=45&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_45"  class="akst_share_link">Share This</a>
</span><div class="feedflare">
<a href="http://feeds.feedburner.com/~f/FlashCs?a=xVBCVHyW"><img src="http://feeds.feedburner.com/~f/FlashCs?d=41" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=SJVpCx0N"><img src="http://feeds.feedburner.com/~f/FlashCs?d=50" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=OjuFzsQk"><img src="http://feeds.feedburner.com/~f/FlashCs?i=OjuFzsQk" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=OE8NFcyY"><img src="http://feeds.feedburner.com/~f/FlashCs?d=52" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=dUh8ak27"><img src="http://feeds.feedburner.com/~f/FlashCs?d=54" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=ocg3RlIE"><img src="http://feeds.feedburner.com/~f/FlashCs?i=ocg3RlIE" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/FlashCs/~4/oRIzCabSiGw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.flashcs.org/globals-in-as3/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.flashcs.org/globals-in-as3/</feedburner:origLink></item>
		<item>
		<title>Flash Meta</title>
		<link>http://feedproxy.google.com/~r/FlashCs/~3/rzzTH0APZKk/</link>
		<comments>http://www.flashcs.org/flash-meta/#comments</comments>
		<pubDate>Sun, 03 Aug 2008 20:40:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[meta]]></category>
		<category><![CDATA[meta data]]></category>

		<guid isPermaLink="false">http://www.flashcs.org/flash-meta/</guid>
		<description><![CDATA[This code/meta data allows you to change settings in the player.

&#91;SWF width=&#34;#&#34;
height=&#34;#&#34;
widthPercent=&#34;#&#34;
heightPercent=&#34;#&#34;
scriptRecursionLimit=&#34;#&#34;
scriptTimeLimit=&#34;#&#34;
frameRate=&#34;#&#34;
backgroundColor=&#34;#&#34;
pageTitle=&#34;&#38;lt;String&#38;gt;&#34;&#93;

Share This
]]></description>
			<content:encoded><![CDATA[<p>This code/meta data allows you to change settings in the player.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #000000;">&#91;</span>SWF <span style="color: #004993;">width</span>=<span style="color: #990000;">&quot;#&quot;</span>
<span style="color: #004993;">height</span>=<span style="color: #990000;">&quot;#&quot;</span>
widthPercent=<span style="color: #990000;">&quot;#&quot;</span>
heightPercent=<span style="color: #990000;">&quot;#&quot;</span>
scriptRecursionLimit=<span style="color: #990000;">&quot;#&quot;</span>
scriptTimeLimit=<span style="color: #990000;">&quot;#&quot;</span>
<span style="color: #004993;">frameRate</span>=<span style="color: #990000;">&quot;#&quot;</span>
<span style="color: #004993;">backgroundColor</span>=<span style="color: #990000;">&quot;#&quot;</span>
pageTitle=<span style="color: #990000;">&quot;&amp;lt;String&amp;gt;&quot;</span><span style="color: #000000;">&#93;</span></pre></div></div>

<span class="akst_link"><a href="http://www.flashcs.org/?p=44&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_44"  class="akst_share_link">Share This</a>
</span><div class="feedflare">
<a href="http://feeds.feedburner.com/~f/FlashCs?a=pmNmb60p"><img src="http://feeds.feedburner.com/~f/FlashCs?d=41" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=vL7ASutl"><img src="http://feeds.feedburner.com/~f/FlashCs?d=50" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=bwpRibJV"><img src="http://feeds.feedburner.com/~f/FlashCs?i=bwpRibJV" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=vVlxQck5"><img src="http://feeds.feedburner.com/~f/FlashCs?d=52" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=uyUVnEd0"><img src="http://feeds.feedburner.com/~f/FlashCs?d=54" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=N0KeBddU"><img src="http://feeds.feedburner.com/~f/FlashCs?i=N0KeBddU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/FlashCs/~4/rzzTH0APZKk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.flashcs.org/flash-meta/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://www.flashcs.org/flash-meta/</feedburner:origLink></item>
		<item>
		<title>Finding Memory Leaks – Memory Usage Guage</title>
		<link>http://feedproxy.google.com/~r/FlashCs/~3/jGglUmvyMyg/</link>
		<comments>http://www.flashcs.org/finding-memory-leaks-memory-usage-guage/#comments</comments>
		<pubDate>Fri, 11 Jul 2008 16:23:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash CS]]></category>
		<category><![CDATA[Memory]]></category>
		<category><![CDATA[Memory Leak]]></category>

		<guid isPermaLink="false">http://www.flashcs.org/finding-memory-leaks-memory-usage-guage/</guid>
		<description><![CDATA[Following on from my previous post about memory leaks I thought I would show you the code I use for spotting for memory leaks at runtime.
See below

import flash.events.*;
import flash.system.System;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.utils.Timer;
&#160;
var tf:TextField = new TextField&#40;&#41;;
tf.border = true;
tf.textColor = 0x333333
tf.background = true
tf.autoSize = TextFieldAutoSize.LEFT;
addChild&#40;tf&#41; 
&#160;
initTimer&#40;&#41;;
&#160;
function initTimer&#40;&#41;:void &#123;
	var myTimer:Timer = new Timer&#40;1000, 0&#41;;
	myTimer.addEventListener&#40;&#34;timer&#34;, timerHandler1&#41;;
	myTimer.start&#40;&#41;;
&#125;
&#160;
function timerHandler1&#40;event:TimerEvent&#41;:void &#123;
	tf.text [...]]]></description>
			<content:encoded><![CDATA[<p>Following on from my previous post about memory leaks I thought I would show you the code I use for spotting for memory leaks at runtime.</p>
<p>See below</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span>.<span style="color: #000000; font-weight: bold;">*</span>;
<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.system</span>.<span style="color: #004993;">System</span>;
<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.text</span>.<span style="color: #004993;">TextField</span>;
<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.text</span>.<span style="color: #004993;">TextFieldAutoSize</span>;
<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.utils</span>.<span style="color: #004993;">Timer</span>;
&nbsp;
<span style="color: #6699cc; font-weight: bold;">var</span> tf<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">TextField</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">TextField</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
tf.<span style="color: #004993;">border</span> = <span style="color: #0033ff; font-weight: bold;">true</span>;
tf.<span style="color: #004993;">textColor</span> = 0x333333
tf.<span style="color: #004993;">background</span> = <span style="color: #0033ff; font-weight: bold;">true</span>
tf.<span style="color: #004993;">autoSize</span> = <span style="color: #004993;">TextFieldAutoSize</span>.<span style="color: #004993;">LEFT</span>;
<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>tf<span style="color: #000000;">&#41;</span> 
&nbsp;
initTimer<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
<span style="color: #339966; font-weight: bold;">function</span> initTimer<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
	<span style="color: #6699cc; font-weight: bold;">var</span> myTimer<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Timer</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Timer</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">1000</span>, <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span>;
	myTimer.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;timer&quot;</span>, timerHandler1<span style="color: #000000;">&#41;</span>;
	myTimer.<span style="color: #004993;">start</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #339966; font-weight: bold;">function</span> timerHandler1<span style="color: #000000;">&#40;</span>event<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">TimerEvent</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
	tf.<span style="color: #004993;">text</span> = <span style="color: #004993;">String</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Math</span>.<span style="color: #004993;">round</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">flash.system</span>.<span style="color: #004993;">System</span>.<span style="color: #004993;">totalMemory</span> <span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000; font-weight:bold;">1000</span> <span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000; font-weight:bold;">1000</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #990000;">&quot; MB <span style="">\n</span> &quot;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #004993;">String</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">flash.system</span>.<span style="color: #004993;">System</span>.<span style="color: #004993;">totalMemory</span><span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #990000;">&quot; Bytes&quot;</span>;
<span style="color: #000000;">&#125;</span></pre></div></div>

<span class="akst_link"><a href="http://www.flashcs.org/?p=43&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_43"  class="akst_share_link">Share This</a>
</span><div class="feedflare">
<a href="http://feeds.feedburner.com/~f/FlashCs?a=6Z8YV0S2"><img src="http://feeds.feedburner.com/~f/FlashCs?d=41" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=Il7v7ulB"><img src="http://feeds.feedburner.com/~f/FlashCs?d=50" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=VjDUtiiC"><img src="http://feeds.feedburner.com/~f/FlashCs?i=VjDUtiiC" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=SJpahTKT"><img src="http://feeds.feedburner.com/~f/FlashCs?d=52" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=Uei5rnXq"><img src="http://feeds.feedburner.com/~f/FlashCs?d=54" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=1pNamW8G"><img src="http://feeds.feedburner.com/~f/FlashCs?i=1pNamW8G" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/FlashCs/~4/jGglUmvyMyg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.flashcs.org/finding-memory-leaks-memory-usage-guage/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.flashcs.org/finding-memory-leaks-memory-usage-guage/</feedburner:origLink></item>
		<item>
		<title>Memory Managment – Memory Leak</title>
		<link>http://feedproxy.google.com/~r/FlashCs/~3/mDHPtTst65k/</link>
		<comments>http://www.flashcs.org/memory-managment-memory-leak/#comments</comments>
		<pubDate>Wed, 09 Jul 2008 15:53:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash CS]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[How to]]></category>
		<category><![CDATA[Event Listeners]]></category>
		<category><![CDATA[Memory]]></category>
		<category><![CDATA[Memory Leak]]></category>
		<category><![CDATA[Weakly Reference]]></category>

		<guid isPermaLink="false">http://www.flashcs.org/memory-managment-memory-leak/</guid>
		<description><![CDATA[Now one of the biggest features of as3 is the management of memory within flash and flex.
In my experience event listeners are the source of about 95 percent of all memory leaks. This is because event listeners are often forgotten by developers, which normally results in the listener never being removed from memory.
This is where [...]]]></description>
			<content:encoded><![CDATA[<p>Now one of the biggest features of as3 is the management of memory within flash and flex.</p>
<p>In my experience event listeners are the source of about 95 percent of all memory leaks. This is because event listeners are often forgotten by developers, which normally results in the listener never being removed from memory.</p>
<p>This is where  weakly referenced event listeners come into their own.</p>
<p>Weakly<span> references to objects that are not counted by the Garbage Collector in determining an object&#8217;s availability for collection.  So if you forget to remove the listener you wont stop the </span>Garbage Collector&#8217;s ability to collect the object and freeing your memory. Yay&#8230;</p>
<p>So from that stand point alone I suggest that you use Weakly reference Event listeners as standard practice.</p>
<p>To make your event listener weakly then just set the fith param in the addEventListner to true.  See code below</p>
<pre class="code">
stage.addEventListener(Event.CLICK, handleClick, false, 0, true);</pre>
<p>Nod to the wondeful <a href="http://www.gskinner.com/blog/archives/2006/08/as3_resource_ma_2.html">gSkinner</a> for this.</p>
<span class="akst_link"><a href="http://www.flashcs.org/?p=42&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_42"  class="akst_share_link">Share This</a>
</span><div class="feedflare">
<a href="http://feeds.feedburner.com/~f/FlashCs?a=XTEubuv0"><img src="http://feeds.feedburner.com/~f/FlashCs?d=41" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=Sq5z9jvZ"><img src="http://feeds.feedburner.com/~f/FlashCs?d=50" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=Yz9QplwY"><img src="http://feeds.feedburner.com/~f/FlashCs?i=Yz9QplwY" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=E3oCdapb"><img src="http://feeds.feedburner.com/~f/FlashCs?d=52" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=bBpAQ6Yb"><img src="http://feeds.feedburner.com/~f/FlashCs?d=54" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=N60VUrXO"><img src="http://feeds.feedburner.com/~f/FlashCs?i=N60VUrXO" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/FlashCs/~4/mDHPtTst65k" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.flashcs.org/memory-managment-memory-leak/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.flashcs.org/memory-managment-memory-leak/</feedburner:origLink></item>
		<item>
		<title>AS3 Email Validation Code Snippets – Regular Expression</title>
		<link>http://feedproxy.google.com/~r/FlashCs/~3/YGJMWM1hayw/</link>
		<comments>http://www.flashcs.org/as3-email-validation-code-snippets-regular-expression/#comments</comments>
		<pubDate>Wed, 16 Apr 2008 18:37:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[Snippet]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[regular]]></category>
		<category><![CDATA[regular expressions]]></category>
		<category><![CDATA[vailidation]]></category>

		<guid isPermaLink="false">http://www.flashcs.org/as3-email-validation-code-snippets-regular-expression/</guid>
		<description><![CDATA[Regular expressions are something that were introduced in AS3 with a sigh of relief from all flash developers. Yay
Below is a code snippet posted by  senocular at kriupa

function isValidEmail&#40;email:String&#41;:Boolean &#123;    
var emailExpression:RegExp = /^&#91;a-z&#93;&#91;\w.-&#93;+@\w&#91;\w.-&#93;+\.&#91;\w.-&#93;*&#91;a-z&#93;&#91;a-z&#93;$/i;
&#160;
return emailExpression.test&#40;email&#41;;
&#160;
&#125;
&#160;
//...
&#160;
trace&#40;isValidEmail&#40;&#34;senocular@example.com&#34;&#41;&#41;; // true
&#160;
trace&#40;isValidEmail&#40;&#34;@example.com&#34;&#41;&#41;; // false
&#160;
trace&#40;isValidEmail&#40;&#34;senocular@example&#34;&#41;&#41;; // false
&#160;
trace&#40;isValidEmail&#40;&#34;seno\\cular@example.com&#34;&#41;&#41;; // false

Its a beautiful thing.
Share This
]]></description>
			<content:encoded><![CDATA[<p>Regular expressions are something that were introduced in AS3 with a sigh of relief from all flash developers. Yay</p>
<p>Below is a code snippet posted by <a href="http://www.kirupa.com/forum/member.php?u=2867"> senocular</a> at <a href="http://www.kirupa.com/forum/showthread.php?p=1914673#post1914673" target="_blank">kriupa</a></p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #339966; font-weight: bold;">function</span> isValidEmail<span style="color: #000000;">&#40;</span>email<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Boolean</span> <span style="color: #000000;">&#123;</span>    
<span style="color: #6699cc; font-weight: bold;">var</span> emailExpression<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">RegExp</span> = <span style="color: #000000; font-weight: bold;">/^</span><span style="color: #000000;">&#91;</span>a<span style="color: #000000; font-weight: bold;">-</span>z<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span>\w.<span style="color: #000000; font-weight: bold;">-</span><span style="color: #000000;">&#93;</span><span style="color: #000000; font-weight: bold;">+</span>@\w<span style="color: #000000;">&#91;</span>\w.<span style="color: #000000; font-weight: bold;">-</span><span style="color: #000000;">&#93;</span><span style="color: #000000; font-weight: bold;">+</span>\.<span style="color: #000000;">&#91;</span>\w.<span style="color: #000000; font-weight: bold;">-</span><span style="color: #000000;">&#93;</span><span style="color: #000000; font-weight: bold;">*</span><span style="color: #000000;">&#91;</span>a<span style="color: #000000; font-weight: bold;">-</span>z<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span>a<span style="color: #000000; font-weight: bold;">-</span>z<span style="color: #000000;">&#93;</span>$<span style="color: #000000; font-weight: bold;">/</span>i;
&nbsp;
<span style="color: #0033ff; font-weight: bold;">return</span> emailExpression.<span style="color: #004993;">test</span><span style="color: #000000;">&#40;</span>email<span style="color: #000000;">&#41;</span>;
&nbsp;
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #009900;">//...</span>
&nbsp;
<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>isValidEmail<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;senocular@example.com&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>; <span style="color: #009900;">// true</span>
&nbsp;
<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>isValidEmail<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;@example.com&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>; <span style="color: #009900;">// false</span>
&nbsp;
<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>isValidEmail<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;senocular@example&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>; <span style="color: #009900;">// false</span>
&nbsp;
<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>isValidEmail<span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;seno<span style="">\\</span>cular@example.com&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>; <span style="color: #009900;">// false</span></pre></div></div>

<p>Its a beautiful thing.</p>
<span class="akst_link"><a href="http://www.flashcs.org/?p=41&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_41"  class="akst_share_link">Share This</a>
</span><div class="feedflare">
<a href="http://feeds.feedburner.com/~f/FlashCs?a=8dx5Q0u8"><img src="http://feeds.feedburner.com/~f/FlashCs?d=41" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=xdkj1KgF"><img src="http://feeds.feedburner.com/~f/FlashCs?d=50" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=RLj9kEn1"><img src="http://feeds.feedburner.com/~f/FlashCs?i=RLj9kEn1" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=7sZDs3qF"><img src="http://feeds.feedburner.com/~f/FlashCs?d=52" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=qPtuHqMe"><img src="http://feeds.feedburner.com/~f/FlashCs?d=54" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=HiCSU4fX"><img src="http://feeds.feedburner.com/~f/FlashCs?i=HiCSU4fX" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/FlashCs/~4/YGJMWM1hayw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.flashcs.org/as3-email-validation-code-snippets-regular-expression/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://www.flashcs.org/as3-email-validation-code-snippets-regular-expression/</feedburner:origLink></item>
		<item>
		<title>Flash Player Update Now Available (Flash Player 9,0,124,0)</title>
		<link>http://feedproxy.google.com/~r/FlashCs/~3/TiyXLVcU5nQ/</link>
		<comments>http://www.flashcs.org/flash-player-update-now-available-flash-player-901240/#comments</comments>
		<pubDate>Tue, 15 Apr 2008 10:00:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flash CS]]></category>
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.flashcs.org/flash-player-update-now-available-flash-player-901240/</guid>
		<description><![CDATA[ 					Last week adobe released there latest flash player
Find it here.
http://www.adobe.com/go/getflashplayer
Share This
]]></description>
			<content:encoded><![CDATA[<p> 					Last week adobe released there latest flash player</p>
<p>Find it here.<br />
<a href="http://www.adobe.com/go/getflashplayer">http://www.adobe.com/go/getflashplayer</a></p>
<span class="akst_link"><a href="http://www.flashcs.org/?p=40&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_40"  class="akst_share_link">Share This</a>
</span><div class="feedflare">
<a href="http://feeds.feedburner.com/~f/FlashCs?a=UquzYhbl"><img src="http://feeds.feedburner.com/~f/FlashCs?d=41" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=8yqHSaSR"><img src="http://feeds.feedburner.com/~f/FlashCs?d=50" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=OdtUPYo0"><img src="http://feeds.feedburner.com/~f/FlashCs?i=OdtUPYo0" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=ZHSPa1nR"><img src="http://feeds.feedburner.com/~f/FlashCs?d=52" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=4OpWi80N"><img src="http://feeds.feedburner.com/~f/FlashCs?d=54" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=Gytk58XX"><img src="http://feeds.feedburner.com/~f/FlashCs?i=Gytk58XX" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/FlashCs/~4/TiyXLVcU5nQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.flashcs.org/flash-player-update-now-available-flash-player-901240/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.flashcs.org/flash-player-update-now-available-flash-player-901240/</feedburner:origLink></item>
		<item>
		<title>Simple Button Class – AS3</title>
		<link>http://feedproxy.google.com/~r/FlashCs/~3/EXEc5Jl7rwY/</link>
		<comments>http://www.flashcs.org/simple-button-class-as3/#comments</comments>
		<pubDate>Mon, 14 Apr 2008 10:00:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[button]]></category>
		<category><![CDATA[simpleButton]]></category>

		<guid isPermaLink="false">http://www.flashcs.org/2008/04/14/simple-button-class-as3/</guid>
		<description><![CDATA[The SimpleButton class is a sweet way to put sprites together to make a button. The SimpleButton is a light weight alternative to the heavier MovieClip object.

var myButton:SimpleButton = new SimpleButton();
myButton.upState = mySprite1;
myButton.overState = mySprite2;
myButton.downState = mySprite3;
myButton.hitAreaState = mySprite4;

You can also draw your sprites on the fly.


var myButton:SimpleButton = new SimpleButton();

//create the look of the [...]]]></description>
			<content:encoded><![CDATA[<p>The SimpleButton class is a sweet way to put sprites together to make a button. The SimpleButton is a light weight alternative to the heavier MovieClip object.</p>
<pre class='code'>
var myButton:SimpleButton = new SimpleButton();
myButton.upState = mySprite1;
myButton.overState = mySprite2;
myButton.downState = mySprite3;
myButton.hitAreaState = mySprite4;
</pre>
<p>You can also draw your sprites on the fly.</p>
<pre class='code'>

var myButton:SimpleButton = new SimpleButton();

//create the look of the states
var down:Sprite = new Sprite();
down.graphics.lineStyle(1, 0x000000);
down.graphics.beginFill(0xFFCC00);
down.graphics.drawRect(10, 10, 100, 30);

var up:Sprite = new Sprite();
up.graphics.lineStyle(1, 0x000000);
up.graphics.beginFill(0x0099FF);
up.graphics.drawRect(10, 10, 100, 30);

var over:Sprite = new Sprite();
over.graphics.lineStyle(1, 0x000000);
over.graphics.beginFill(0x9966FF);
over.graphics.drawRect(10, 10, 100, 30);

// assign the sprites
myButton.upState = up;
myButton.overState = over;
myButton.downState = down;
myButton.hitTestState = up;
</pre>
<span class="akst_link"><a href="http://www.flashcs.org/?p=39&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_39"  class="akst_share_link">Share This</a>
</span><div class="feedflare">
<a href="http://feeds.feedburner.com/~f/FlashCs?a=WpoMfhze"><img src="http://feeds.feedburner.com/~f/FlashCs?d=41" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=nq4tI3uP"><img src="http://feeds.feedburner.com/~f/FlashCs?d=50" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=x86CfI7h"><img src="http://feeds.feedburner.com/~f/FlashCs?i=x86CfI7h" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=j9xLGBBi"><img src="http://feeds.feedburner.com/~f/FlashCs?d=52" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=AdhhyXFQ"><img src="http://feeds.feedburner.com/~f/FlashCs?d=54" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=bwlL5hWt"><img src="http://feeds.feedburner.com/~f/FlashCs?i=bwlL5hWt" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/FlashCs/~4/EXEc5Jl7rwY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.flashcs.org/simple-button-class-as3/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.flashcs.org/simple-button-class-as3/</feedburner:origLink></item>
		<item>
		<title>Detect when the mouse leaves the movie.</title>
		<link>http://feedproxy.google.com/~r/FlashCs/~3/fGEx3aiOgvE/</link>
		<comments>http://www.flashcs.org/detect-when-the-mouse-leaves-the-movie/#comments</comments>
		<pubDate>Sun, 13 Apr 2008 10:00:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AS3]]></category>
		<category><![CDATA[detect]]></category>
		<category><![CDATA[Mouse]]></category>

		<guid isPermaLink="false">http://www.flashcs.org/2008/04/13/detect-when-the-mouse-leaves-the-movie/</guid>
		<description><![CDATA[I previous of flash there was no way to detect when the users mouse had left the flash movie.
Actionscript 3 now allows you to detect when the users mouse has left the movie using the mouseLeave event.
Lets take  a look:

package {
    import flash.events.Event;
    import flash.events.MouseEvent;

    [...]]]></description>
			<content:encoded><![CDATA[<p>I previous of flash there was no way to detect when the users mouse had left the flash movie.</p>
<p>Actionscript 3 now allows you to detect when the users mouse has left the movie using the mouseLeave event.</p>
<p>Lets take  a look:</p>
<pre class="code">
package {
    import flash.events.Event;
    import flash.events.MouseEvent;

    public class mouseLeaveTest extends Sprite {

        public function mouseLeaveTest() {
            stage.addEventListener(Event.MOUSE_LEAVE, mouseHasLeft);
        }

        public function mouseHasLeft)(e:Event):void {
            trace('Mouse have left the stage');
        }

    }
}</pre>
<span class="akst_link"><a href="http://www.flashcs.org/?p=38&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_38"  class="akst_share_link">Share This</a>
</span><div class="feedflare">
<a href="http://feeds.feedburner.com/~f/FlashCs?a=q8bz7lQ7"><img src="http://feeds.feedburner.com/~f/FlashCs?d=41" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=T9CVzQqa"><img src="http://feeds.feedburner.com/~f/FlashCs?d=50" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=XnhaqFY5"><img src="http://feeds.feedburner.com/~f/FlashCs?i=XnhaqFY5" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=jGIbhcdx"><img src="http://feeds.feedburner.com/~f/FlashCs?d=52" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=DxLmnoGd"><img src="http://feeds.feedburner.com/~f/FlashCs?d=54" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/FlashCs?a=fq8aW7WO"><img src="http://feeds.feedburner.com/~f/FlashCs?i=fq8aW7WO" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/FlashCs/~4/fGEx3aiOgvE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.flashcs.org/detect-when-the-mouse-leaves-the-movie/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://www.flashcs.org/detect-when-the-mouse-leaves-the-movie/</feedburner:origLink></item>
	</channel>
</rss>
