<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Is Good Stuff &#187; actionscript</title>
	<atom:link href="http://www.isgoodstuff.com/tag/actionscript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.isgoodstuff.com</link>
	<description>All the good stuff here!</description>
	<lastBuildDate>Mon, 30 Jan 2012 01:31:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
		<item>
		<title>AS3 Implementing Keyboard Controls</title>
		<link>http://www.isgoodstuff.com/2011/12/05/as3-implementing-keyboard-controls/</link>
		<comments>http://www.isgoodstuff.com/2011/12/05/as3-implementing-keyboard-controls/#comments</comments>
		<pubDate>Mon, 05 Dec 2011 07:35:13 +0000</pubDate>
		<dc:creator>Alex T.</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.isgoodstuff.com/?p=2048</guid>
		<description><![CDATA[<p><img src="http://www.isgoodstuff.com/wp-content/uploads/2011/12/keyboardControls.png"/></p>Been busy lately, today we will cover on keyboardEvent and controls in as3. ]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.isgoodstuff.com/wp-content/uploads/2011/12/keyboardControls.png"/></p><p style="text-align: justify;">Today we will cover the topic on having a keyboard controls in AS3. This is an important element in game and interactive programming involving keyboard as input.</p>
<p style="text-align: justify;">Like usual, below is a sample demo of my flash embedded. Try using arrow keys and spacebar. Watch the blue box move according to your controls. If the screen is too small, try click on the flash below to start.</p>
<p style="text-align: center;"><object width="300" height="300" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://www.isgoodstuff.com/wp-content/uploads/2011/12/keyControls.swf" /><embed width="300" height="300" type="application/x-shockwave-flash" src="http://www.isgoodstuff.com/wp-content/uploads/2011/12/keyControls.swf" /></object></p>
<p>Below are the source code and sample on how keyboard listeners are used in AS3.</p>
<h6><strong>Main.as</strong></h6>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">package 
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #0066CC;">MovieClip</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">KeyboardEvent</span>;
&nbsp;
	<span style="color: #808080; font-style: italic;">/********************************************************************
	* Description : This is the main document Class file.
	* @author Alex T.
	 ********************************************************************/</span>
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span>  Main <span style="color: #0066CC;">extends</span> <span style="color: #0066CC;">MovieClip</span>
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> mcCursor:<span style="color: #0066CC;">MovieClip</span>;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> MCCURSOR_X:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">150</span>;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> MCCURSOR_Y:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">150</span>;
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> Main<span style="color: #66cc66;">&#40;</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
			resetCursorPosition<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #808080; font-style: italic;">// Attaching stage keyListeners to listen to keyboard input </span>
			<span style="color: #0066CC;">stage</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>KeyboardEvent.<span style="color: #006600;">KEY_DOWN</span>, handleKeyDown <span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> handleKeyDown<span style="color: #66cc66;">&#40;</span> event:KeyboardEvent <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
			<span style="color: #808080; font-style: italic;">// This is where we handle what to do when there's an input</span>
                        <span style="color: #808080; font-style: italic;">// event.keyCode returns a keyCode of the particular keyboard key.</span>
			<span style="color: #808080; font-style: italic;">// trace( &quot;KeyCode received : &quot; + event.keyCode ) ;</span>
			<span style="color: #b1b100;">switch</span> <span style="color: #66cc66;">&#40;</span>event.<span style="color: #006600;">keyCode</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
				<span style="color: #b1b100;">case</span> <span style="color: #cc66cc;">32</span>:
					      <span style="color: #808080; font-style: italic;">// Spacebar is pressed. Enables recentering.</span>
					      resetCursorPosition<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
				<span style="color: #b1b100;">break</span>;
&nbsp;
				<span style="color: #b1b100;">case</span> <span style="color: #cc66cc;">37</span>:
					      <span style="color: #808080; font-style: italic;">// key left</span>
                                              mcCursor.<span style="color: #006600;">x</span> = mcCursor.<span style="color: #006600;">x</span> - <span style="color: #cc66cc;">2</span>;
				<span style="color: #b1b100;">break</span>;
&nbsp;
				<span style="color: #b1b100;">case</span> <span style="color: #cc66cc;">38</span>:
					      <span style="color: #808080; font-style: italic;">// key up   	</span>
                                              mcCursor.<span style="color: #006600;">y</span> = mcCursor.<span style="color: #006600;">y</span> - <span style="color: #cc66cc;">2</span>;
				<span style="color: #b1b100;">break</span>;
&nbsp;
				<span style="color: #b1b100;">case</span> <span style="color: #cc66cc;">39</span>:
                                              <span style="color: #808080; font-style: italic;">// key right						</span>
                                              mcCursor.<span style="color: #006600;">x</span> = mcCursor.<span style="color: #006600;">x</span> + <span style="color: #cc66cc;">2</span>;
				<span style="color: #b1b100;">break</span>;
&nbsp;
				<span style="color: #b1b100;">case</span> <span style="color: #cc66cc;">40</span>:
					      <span style="color: #808080; font-style: italic;">// key down						</span>
                                              mcCursor.<span style="color: #006600;">y</span> = mcCursor.<span style="color: #006600;">y</span> + <span style="color: #cc66cc;">2</span>;
				<span style="color: #b1b100;">break</span>;
			<span style="color: #66cc66;">&#125;</span>
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> resetCursorPosition<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
			mcCursor.<span style="color: #006600;">x</span> = MCCURSOR_X;
			mcCursor.<span style="color: #006600;">y</span> = MCCURSOR_Y;
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>Today&#8217;s source code tutorial downloadable below.<br />
<p><strong><a href="http://www.isgoodstuff.com/wp-content/plugins/download-monitor/download.php?id=29">Download Here</a></strong></p></br></p>
]]></content:encoded>
			<wfw:commentRss>http://www.isgoodstuff.com/2011/12/05/as3-implementing-keyboard-controls/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>AS3 Using Custom Event &#8211; dispatchEvent</title>
		<link>http://www.isgoodstuff.com/2011/11/22/as3-using-custom-event-dispatchevent/</link>
		<comments>http://www.isgoodstuff.com/2011/11/22/as3-using-custom-event-dispatchevent/#comments</comments>
		<pubDate>Tue, 22 Nov 2011 02:04:38 +0000</pubDate>
		<dc:creator>Alex T.</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.isgoodstuff.com/?p=2038</guid>
		<description><![CDATA[<p><img src="http://www.isgoodstuff.com/wp-content/uploads/2011/11/megaphone.png"/></p>Short tutorial on what, how and when to use dispatchEvent in as3. Read more...]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.isgoodstuff.com/wp-content/uploads/2011/11/megaphone.png"/></p><p style="text-align: justify;">Sometimes, we want a particular class to do something however, that task requires time to complete (e.g. loading XML or list of images remotely) and some process still awaits a form of &#8220;signal&#8221; to proceed. Pretty much like the real life shown in picture below. </p>
<p style="text-align: center;"><img src="http://www.isgoodstuff.com/wp-content/uploads/2011/11/ok.png"/></p>
<p style="text-align: justify;">See sample demo below. It&#8217;s a simple rss Reader that reads feed from CNN. Today&#8217;s sample is to show how a class can dispatch a custom event so that, the main class (which is listening to the customEvent) can trigger a specific function.</p>
<p style="text-align: center;"><object width="400" height="400" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://www.isgoodstuff.com/wp-content/uploads/2011/11/rssReader.swf" /><embed width="400" height="400" type="application/x-shockwave-flash" src="http://www.isgoodstuff.com/wp-content/uploads/2011/11/rssReader.swf" /></object></p>
<p style="text-align: justify;">
<p style="text-align: justify;">See source code below on how Main.as which listens to a customEvent called RSSReady and triggers a function when mcRSSContainer is done with loaded the data.</p>
<h6>Main.as</h6>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">package  
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #0066CC;">MovieClip</span>;
	<span style="color: #808080; font-style: italic;">/********************************************************************
	 * Description : This is the main document root file.
	 * @author Alex T.
	 ********************************************************************/</span>
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Main <span style="color: #0066CC;">extends</span> <span style="color: #0066CC;">MovieClip</span>
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> mcPreloader : <span style="color: #0066CC;">MovieClip</span>;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> mcRSSContainer:<span style="color: #0066CC;">MovieClip</span>;
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> Main<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> 
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;init!&quot;</span><span style="color: #66cc66;">&#41;</span> ;
			mcPreloader.<span style="color: #0066CC;">visible</span> = <span style="color: #000000; font-weight: bold;">true</span>;
			<span style="color: #808080; font-style: italic;">// Since, mcRSSContainer is the stage object of the class, </span>
			<span style="color: #808080; font-style: italic;">// we attach the listener here.This behaviour is similar to a doctor </span>
			<span style="color: #808080; font-style: italic;">// placing a stethoscope on your body to listen for heartbeat.</span>
			<span style="color: #808080; font-style: italic;">// listening for the RSSReady customEvent to be dispatch.</span>
			mcRSSContainer.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;RSSReady&quot;</span>, handleRSSReady<span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> handleRSSReady<span style="color: #66cc66;">&#40;</span>event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
			mcPreloader.<span style="color: #0066CC;">visible</span> = <span style="color: #000000; font-weight: bold;">false</span>;
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<h6>mcRSSContainer.as</h6>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">package com.<span style="color: #006600;">isgoodstuff</span> 
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">import</span> fl.<span style="color: #006600;">controls</span>.<span style="color: #0066CC;">List</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #0066CC;">MovieClip</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">Event</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">net</span>.<span style="color: #006600;">FileReferenceList</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">net</span>.<span style="color: #006600;">URLLoader</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">net</span>.<span style="color: #006600;">URLRequest</span>;
	<span style="color: #808080; font-style: italic;">/********************************************************************
	* Description : This is mcRSSContainer Class. 
	* Contains a ListBox component. This class will load RSS using 
	* a URLLoader and then once loaded, sends a customEvent  or 
	* (dispatchEvent) which the Main is listening to, in order to hide 
	* mcPreloader.
	* @author Alex T.
	********************************************************************/</span>
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> mcRSSContainer <span style="color: #0066CC;">extends</span> <span style="color: #0066CC;">MovieClip</span>
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> listBox:<span style="color: #0066CC;">List</span>;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> rssLoader:URLLoader = <span style="color: #000000; font-weight: bold;">new</span> URLLoader<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> rssXML:<span style="color: #0066CC;">XML</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">XML</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> mcRSSContainer<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> 
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;mcRSSContainer successfully initiatialize&quot;</span><span style="color: #66cc66;">&#41;</span>;
			startLoadingRSS<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> startLoadingRSS<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">var</span> rssURL:URLRequest =  <span style="color: #000000; font-weight: bold;">new</span> URLRequest<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;http://rss.cnn.com/rss/edition.rss&quot;</span><span style="color: #66cc66;">&#41;</span>;
			rssLoader.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">COMPLETE</span>, rssLoaded<span style="color: #66cc66;">&#41;</span>;
			rssLoader.<span style="color: #0066CC;">load</span><span style="color: #66cc66;">&#40;</span>rssURL<span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> rssLoaded<span style="color: #66cc66;">&#40;</span>event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
			rssXML.<span style="color: #006600;">ignoreWhitespace</span> = <span style="color: #000000; font-weight: bold;">true</span>;
			rssXML = <span style="color: #0066CC;">XML</span><span style="color: #66cc66;">&#40;</span>rssLoader.<span style="color: #0066CC;">data</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> item:<span style="color: #0066CC;">String</span> <span style="color: #b1b100;">in</span> rssXML.<span style="color: #006600;">channel</span>.<span style="color: #006600;">item</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
				listBox.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span> <span style="color: #66cc66;">&#123;</span>label: rssXML.<span style="color: #006600;">channel</span>.<span style="color: #006600;">item</span><span style="color: #66cc66;">&#91;</span>item<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">title</span> <span style="color: #66cc66;">&#125;</span> <span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
			<span style="color: #808080; font-style: italic;">// This means the class has done all the RSS loading. Now we need to send a custom</span>
			<span style="color: #808080; font-style: italic;">// Event (dispatchEvent) like a shout to other classes listening that data is ready.</span>
			<span style="color: #808080; font-style: italic;">// The string RSSReady can be any other custom Event name you wanted. Just</span>
			<span style="color: #808080; font-style: italic;">// Make sure when attaching listener has to &quot;listen For&quot; the particular string event.</span>
			<span style="color: #808080; font-style: italic;">// Now see the mcRSSContainer.addEventListener(&quot;RSSReady&quot;, handleRSSReady); </span>
			<span style="color: #808080; font-style: italic;">// under Main.as</span>
			dispatchEvent<span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> Event<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;RSSReady&quot;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>For today&#8217;s tutorial click the link below.<br />
<p><strong><a href="http://www.isgoodstuff.com/wp-content/plugins/download-monitor/download.php?id=28">Download Here</a></strong></p></br></p>
]]></content:encoded>
			<wfw:commentRss>http://www.isgoodstuff.com/2011/11/22/as3-using-custom-event-dispatchevent/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AS3 Using a Static Class (Singleton)</title>
		<link>http://www.isgoodstuff.com/2011/11/20/as3-using-a-static-class-singleton/</link>
		<comments>http://www.isgoodstuff.com/2011/11/20/as3-using-a-static-class-singleton/#comments</comments>
		<pubDate>Sun, 20 Nov 2011 03:45:37 +0000</pubDate>
		<dc:creator>Alex T.</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.isgoodstuff.com/?p=2025</guid>
		<description><![CDATA[<p><img src="http://www.isgoodstuff.com/wp-content/uploads/2010/06/As3-222x180.png"/></p>Today post is about a simple Singleton tutorial and how we use it in actionscript 3. ]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.isgoodstuff.com/wp-content/uploads/2010/06/As3-222x180.png"/></p><p>In simple term &#8211; a static /singleton class</p>
<ul>
<li>Restricted instantiation to one object. Only one can be loaded in memory and shared by all classes that import it.</li>
<li>Don&#8217;t have to instantiate it like other class. e.g. if the class is called GlobalStatic. You don&#8217;t have to do this, <em>var myObject = new GlobalStatic(); We directly access it using GlobalStatic.methodName();</em></li>
<li>Useful to pass data and share data globally.</li>
</ul>
<p>Today, tutorial is just to introduce the concept of static / singleton in AS3 programming.</p>
<p>Before we start, let&#8217;s that a look at the actual demo script below. Notice, how the singleton work as a central memory, where you can &#8220;set&#8221; data to it and &#8220;get&#8221; data from it.</p>
<p>&nbsp;</p>
<p align="center"><object width="300" height="400" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://www.isgoodstuff.com/wp-content/uploads/2011/11/singleton.swf" /><embed width="300" height="400" type="application/x-shockwave-flash" src="http://www.isgoodstuff.com/wp-content/uploads/2011/11/singleton.swf" /></object></p>
<p>There&#8217;s actually 4 document classes written in this tutorial. Main.as which is the main class, GlobalStatic our singleton sample, mcRed and mcBlue. Before we start, is best you download the source file below here.<br />
<p><strong><a href="http://www.isgoodstuff.com/wp-content/plugins/download-monitor/download.php?id=30">Download Here</a></strong></p></br></p>
<h5>Main.as</h5>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">package  
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #0066CC;">MovieClip</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">Event</span>;
	<span style="color: #808080; font-style: italic;">// Every class that import GlobalStatic can share the same method and </span>
	<span style="color: #808080; font-style: italic;">// singleton class, you dont need instantiate it. </span>
	<span style="color: #808080; font-style: italic;">// e.g. myGlobalStaticObject = new GlobalStatic();</span>
	<span style="color: #808080; font-style: italic;">// We just use it's name like GlobalStatic.methodName( );</span>
	<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">isgoodstuff</span>.<span style="color: #006600;">GlobalStatic</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #0066CC;">text</span>.<span style="color: #0066CC;">TextField</span>;
&nbsp;
	<span style="color: #808080; font-style: italic;">/************************************************************
	 * Description : This is the main actionscript file.
	 * @author Alex T.
	 ***********************************************************/</span>
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Main <span style="color: #0066CC;">extends</span> <span style="color: #0066CC;">MovieClip</span>
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #808080; font-style: italic;">// Note : In this demo, mcGlobalStatic is just a visual representation of the GlobalStatic</span>
		<span style="color: #808080; font-style: italic;">// as everything is stored in memory.</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> txtBlueScore:<span style="color: #0066CC;">TextField</span>;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> txtRedScore:<span style="color: #0066CC;">TextField</span>;
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> Main<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> 
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #808080; font-style: italic;">//Resets when the Main starts initializing</span>
			txtRedScore.<span style="color: #0066CC;">text</span> = <span style="color: #ff0000;">&quot;0&quot;</span>;
			txtBlueScore.<span style="color: #0066CC;">text</span> = <span style="color: #ff0000;">&quot;0&quot;</span>;
			<span style="color: #808080; font-style: italic;">// Run all the time, to update the Main's fla txtBlueScore and txtRedScore</span>
			<span style="color: #808080; font-style: italic;">// from GlobalStatic</span>
			<span style="color: #0066CC;">this</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">ENTER_FRAME</span>, handleUpdateScores<span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> handleUpdateScores<span style="color: #66cc66;">&#40;</span>event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
			txtBlueScore.<span style="color: #0066CC;">text</span> = GlobalStatic.<span style="color: #006600;">blueScore</span>;
			txtRedScore.<span style="color: #0066CC;">text</span> = GlobalStatic.<span style="color: #006600;">redScore</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
	<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<h5>GlobalStatic.as</h5>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">package com.<span style="color: #006600;">isgoodstuff</span> 
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #0066CC;">MovieClip</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #0066CC;">text</span>.<span style="color: #0066CC;">TextField</span>;
&nbsp;
	<span style="color: #808080; font-style: italic;">/****************************************************************************
	 * Description : This is the mcGlobalStatic / Singleton Class 
	 * actionscript file. Is a good practice to place all your other class 
	 * files inside a sub folders, com means common libraries folder
	 * isgoodstuff can be the company or organization. 
	 * @author Alex T.
	 ***************************************************************************/</span>
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> GlobalStatic <span style="color: #0066CC;">extends</span> <span style="color: #0066CC;">MovieClip</span>
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">var</span> _iRedScore:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">0</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">var</span> _iBlueScore:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">0</span>;
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> GlobalStatic<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> 
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #808080; font-style: italic;">// Very useful to cross reference and sending data across classes.</span>
			<span style="color: #808080; font-style: italic;">// See how mcRed and mcBlue get data from each other using</span>
			<span style="color: #808080; font-style: italic;">// globalStatic</span>
			<span style="color: #0066CC;">trace</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Initializing globalStatic / Singleton Class&quot;</span><span style="color: #66cc66;">&#41;</span>;
			_iRedScore = <span style="color: #cc66cc;">0</span>;
			_iBlueScore = <span style="color: #cc66cc;">0</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #808080; font-style: italic;">// This is how to make a setter. So that other class can just use </span>
		<span style="color: #808080; font-style: italic;">// GlobalStatic.redScore = value; to assign latest redScore</span>
		<span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">set</span> redScore<span style="color: #66cc66;">&#40;</span>value:<span style="color: #0066CC;">int</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
			_iRedScore = value;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #808080; font-style: italic;">// This is how to make a getter. So that other class can just use </span>
		<span style="color: #808080; font-style: italic;">// var myRedScore =  GlobalStatic.redScore to get latest redScore</span>
		<span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> redScore<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
			<span style="color: #b1b100;">return</span> _iRedScore;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #808080; font-style: italic;">// This is how to make a setter. So that other class can just use </span>
		<span style="color: #808080; font-style: italic;">// GlobalStatic.blueScore = value; to assign latest blueScore</span>
		<span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">set</span> blueScore<span style="color: #66cc66;">&#40;</span>value:<span style="color: #0066CC;">int</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
			_iBlueScore = value;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #808080; font-style: italic;">// This is how to make a getter. So that other class can just use </span>
		<span style="color: #808080; font-style: italic;">// var myBlueScore = GlobalStatic.blueScore to get latest blueScore</span>
		<span style="color: #0066CC;">public</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> blueScore<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
			<span style="color: #b1b100;">return</span> _iBlueScore;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
	<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<h5>mcRed.as</h5>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">package com.<span style="color: #006600;">isgoodstuff</span> 
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #0066CC;">MovieClip</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">MouseEvent</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #0066CC;">text</span>.<span style="color: #0066CC;">TextField</span>;
        <span style="color: #808080; font-style: italic;">// To get and receive value from GlobalStatic, we must first include it into our import</span>
	<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">isgoodstuff</span>.<span style="color: #006600;">GlobalStatic</span>;
&nbsp;
	<span style="color: #808080; font-style: italic;">/************************************************************
	 * Description : This is the mcRed Class actionscript file.
	 * It is binded to the movieClip in Library named mcRed.
	 * @author Alex T.
	 ***********************************************************/</span>
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> mcRed <span style="color: #0066CC;">extends</span> <span style="color: #0066CC;">MovieClip</span>
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #808080; font-style: italic;">// Instance placed in stage must be declared public var before</span>
		<span style="color: #808080; font-style: italic;">// they can be used.</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> txtRedScore : <span style="color: #0066CC;">TextField</span>;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> txtBlueScore : <span style="color: #0066CC;">TextField</span>;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> btnSet:<span style="color: #0066CC;">MovieClip</span>;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> btnGet:<span style="color: #0066CC;">MovieClip</span>;
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> mcRed<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> 
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #808080; font-style: italic;">//Reseting own numbers in own textfield.</span>
			txtBlueScore.<span style="color: #0066CC;">text</span> = <span style="color: #ff0000;">&quot;0&quot;</span>;
			txtRedScore.<span style="color: #0066CC;">text</span> = <span style="color: #ff0000;">&quot;0&quot;</span>;
			btnGet.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>, handleGetClick <span style="color: #66cc66;">&#41;</span>;
			btnSet.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>, handleSetClick <span style="color: #66cc66;">&#41;</span> ;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> handleGetClick<span style="color: #66cc66;">&#40;</span>event<span style="color: #66cc66;">&#41;</span> :<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
			txtBlueScore.<span style="color: #0066CC;">text</span> = <span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#40;</span>GlobalStatic.<span style="color: #006600;">blueScore</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> handleSetClick<span style="color: #66cc66;">&#40;</span>event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
			GlobalStatic.<span style="color: #006600;">redScore</span> = <span style="color: #0066CC;">parseInt</span><span style="color: #66cc66;">&#40;</span>txtRedScore.<span style="color: #0066CC;">text</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
	<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<h5>mcBlue.as</h5>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">package com.<span style="color: #006600;">isgoodstuff</span> 
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #0066CC;">MovieClip</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">MouseEvent</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #0066CC;">text</span>.<span style="color: #0066CC;">TextField</span>;
	<span style="color: #808080; font-style: italic;">// To get and receive value from GlobalStatic, we must first include it into our import</span>
	<span style="color: #0066CC;">import</span> com.<span style="color: #006600;">isgoodstuff</span>.<span style="color: #006600;">GlobalStatic</span>;
&nbsp;
	<span style="color: #808080; font-style: italic;">/************************************************************
	 * Description : This is the mcBlue Class actionscript file.
	 *It is binded to the movieClip in Library named mcBlue.
	 * @author Alex T.
	 ***********************************************************/</span>
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> mcBlue <span style="color: #0066CC;">extends</span> <span style="color: #0066CC;">MovieClip</span>
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #808080; font-style: italic;">// Instance placed in stage must be declared public var before</span>
		<span style="color: #808080; font-style: italic;">// they can be used.</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> txtRedScore : <span style="color: #0066CC;">TextField</span>;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> txtBlueScore : <span style="color: #0066CC;">TextField</span>;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> btnSet:<span style="color: #0066CC;">MovieClip</span>;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> btnGet:<span style="color: #0066CC;">MovieClip</span>;
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> mcBlue<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> 
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #808080; font-style: italic;">//Reseting own numbers in own textfield.</span>
			txtBlueScore.<span style="color: #0066CC;">text</span> = <span style="color: #ff0000;">&quot;0&quot;</span>;
			txtRedScore.<span style="color: #0066CC;">text</span> = <span style="color: #ff0000;">&quot;0&quot;</span>;
			btnGet.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>, handleGetClick <span style="color: #66cc66;">&#41;</span>;
			btnSet.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">CLICK</span>, handleSetClick <span style="color: #66cc66;">&#41;</span> ;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> handleGetClick<span style="color: #66cc66;">&#40;</span>event<span style="color: #66cc66;">&#41;</span> :<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
			txtRedScore.<span style="color: #0066CC;">text</span> = <span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#40;</span>GlobalStatic.<span style="color: #006600;">redScore</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> handleSetClick<span style="color: #66cc66;">&#40;</span>event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
			GlobalStatic.<span style="color: #006600;">blueScore</span> = <span style="color: #0066CC;">parseInt</span><span style="color: #66cc66;">&#40;</span>txtBlueScore.<span style="color: #0066CC;">text</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
	<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p style="text-align: justify;">I hope in this tutorial, will give you insight of how singleton is use in daily oop programming. I personally like to use them as reusable utility classes like calculateDistance, findAngle for game programming and etc. Sometimes, movieClip instance can be passed in as well so that, the other class can access it properties.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.isgoodstuff.com/2011/11/20/as3-using-a-static-class-singleton/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>AS3  Simple Loader for External Image</title>
		<link>http://www.isgoodstuff.com/2011/11/15/as3-simple-loader-for-external-image/</link>
		<comments>http://www.isgoodstuff.com/2011/11/15/as3-simple-loader-for-external-image/#comments</comments>
		<pubDate>Tue, 15 Nov 2011 04:22:09 +0000</pubDate>
		<dc:creator>Alex T.</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Useful Scripts]]></category>

		<guid isPermaLink="false">http://www.isgoodstuff.com/?p=1988</guid>
		<description><![CDATA[<p><img src="http://www.isgoodstuff.com/wp-content/uploads/2011/11/thumbB.png"/></p>Simple package script to load an external image using Loader Class.]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.isgoodstuff.com/wp-content/uploads/2011/11/thumbB.png"/></p><p style="text-align: justify;">Today&#8217;s tutorial, I&#8217;m covering on how to write a simple Loader class in AS3 to load external image. Why the hassle? Well loader Class is useful to load lots of stuff, image being one of em &#8211; loading externally thus, swf size is reduced.</p>
<p style="text-align: justify;">You can then design your movieclip with nice spinning preloader animation while waiting for image to load externally. See swf below is the sample.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">package  
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #808080; font-style: italic;">// Importing all the class needed for the job.</span>
        <span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #0066CC;">MovieClip</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Loader</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">Event</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">net</span>.<span style="color: #006600;">URLRequest</span>;
	<span style="color: #808080; font-style: italic;">/**
	 * Description : A Simple Class to Load External Images.
	 * URL : http://www.isgoodstuff.com
	 * @author Alex T.
	 **/</span>
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Main <span style="color: #0066CC;">extends</span> <span style="color: #0066CC;">MovieClip</span>
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> mcPreloader:<span style="color: #0066CC;">MovieClip</span>;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> mcContainer:<span style="color: #0066CC;">MovieClip</span>;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> myImgLoader:Loader = <span style="color: #000000; font-weight: bold;">new</span> Loader<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> Main<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> 
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #808080; font-style: italic;">// Inside the flas contains two onStage movieClip named mcPreloader and mcContainer.</span>
			<span style="color: #808080; font-style: italic;">// Once the image is loaded, mcPreloader will disappear and mcContainer will be used</span>
			<span style="color: #808080; font-style: italic;">// to contain the new image. (Jessica Alba's Pic)</span>
			myImgLoader.<span style="color: #0066CC;">load</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> URLRequest<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;http://www.isgoodstuff.com/wp-content/uploads/2011/11/sample.png&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
			myImgLoader.<span style="color: #006600;">contentLoaderInfo</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">COMPLETE</span>, handleLoadCompleted<span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> handleLoadCompleted<span style="color: #66cc66;">&#40;</span>evt:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
			mcPreloader.<span style="color: #0066CC;">visible</span> = <span style="color: #000000; font-weight: bold;">false</span>;
			<span style="color: #808080; font-style: italic;">// Once loaded, you can set it's height and width</span>
			myImgLoader.<span style="color: #0066CC;">width</span> = <span style="color: #cc66cc;">300</span>;
			myImgLoader.<span style="color: #0066CC;">height</span> = <span style="color: #cc66cc;">300</span>;
			mcContainer.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span> myImgLoader <span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p align="center"><object width="300" height="300" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://www.isgoodstuff.com/wp-content/uploads/2011/11/simpleLoader.swf" /><embed width="300" height="300" type="application/x-shockwave-flash" src="http://www.isgoodstuff.com/wp-content/uploads/2011/11/simpleLoader.swf" /></object></p>
<p>For Today&#8217;s Tutorial click on the link below&#8230;<br />
<p><strong><a href="http://www.isgoodstuff.com/wp-content/plugins/download-monitor/download.php?id=26">Download Here</a></strong></p></br></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.isgoodstuff.com/2011/11/15/as3-simple-loader-for-external-image/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Useful Flash CS Extension &#8211; Hook&#8217;s Outliner</title>
		<link>http://www.isgoodstuff.com/2011/02/24/useful-flash-cs-extension-hooks-outliner/</link>
		<comments>http://www.isgoodstuff.com/2011/02/24/useful-flash-cs-extension-hooks-outliner/#comments</comments>
		<pubDate>Thu, 24 Feb 2011 01:14:36 +0000</pubDate>
		<dc:creator>Alex T.</dc:creator>
				<category><![CDATA[Good Stuff]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[extension]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Tech]]></category>

		<guid isPermaLink="false">http://www.isgoodstuff.com/?p=1751</guid>
		<description><![CDATA[<p><img src="http://www.isgoodstuff.com/wp-content/uploads/et_temp/BlogHook1-196006_300x185.png"/></p>As your FLA file gets bigger do you know at which layers your shapes, symbols, graphics or movieclip situated?? Confuse whenever opening someone's FLA? Solution...]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.isgoodstuff.com/wp-content/uploads/et_temp/BlogHook1-196006_300x185.png"/></p><p style="text-align: justify;">The most annoying problem in Adobe Flash, is not being able to trace visually, at which layers (after browsing through 30-50 over layers some locked and some not, some grouped or some not) your symbols, graphics or movieclip is situated.</p>
<p style="text-align: center;"><a href="http://www.isgoodstuff.com/wp-content/uploads/2011/02/BlogHook1.png"><img class="aligncenter size-full wp-image-1754" title="BlogHook1" src="http://www.isgoodstuff.com/wp-content/uploads/2011/02/BlogHook1.png" alt="" width="465" height="185" /></a></p>
<p style="text-align: justify;">Gosh, it&#8217;s even frustrating to relate to the picture above&#8230;Poor girls&#8230;( they are cute tho <img src='http://www.isgoodstuff.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  ) I remember my &#8220;unproductive&#8221; days of traversing back and forth on the matter which later causes Adobe Flash CS to crash due to poor memory management &#8211; great what a good day to start a day, right?</p>
<p style="text-align: justify;">Let&#8217;s not talk about frustration anymore, we are all here to get good stuff right? &#8211; that&#8217;s why I wrote this blog for in the first place <img src='http://www.isgoodstuff.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p style="text-align: justify;">Today&#8217;s I will introduce a handy extension (installed just by double clicking mxp file) and restart your flash IDE) &#8211; the Hook&#8217;s Outliner.</p>
<blockquote>
<p style="text-align: justify;">What good can this humble outliner extension do?</p>
<p style="text-align: justify;">Well take a look at the screeny below&#8230;</p>
</blockquote>
<p style="text-align: center;"><a href="http://www.isgoodstuff.com/wp-content/uploads/2011/02/nightmare01.png"><img class="aligncenter size-full wp-image-1752" style="border: 1px gray solid;" title="nightmare01" src="http://www.isgoodstuff.com/wp-content/uploads/2011/02/nightmare01.png" alt="" width="452" height="226" /></a>The nightmares of opening somebody&#8217;s FLA file and editing it.</p>
<blockquote>
<p style="text-align: justify;">Groups of folders, overlapping movieclips and graphics etc etc. Especially locating shape which doesn&#8217;t exist in library.<br />
<em>Does this question like &#8220;Now where is the red dot shape that I needed to delete in this freaking huge fla file?&#8221; rings a bell?</em></p>
</blockquote>
<p style="text-align: justify;">Quickyly to save your &#8220;sanity&#8221;, after installing Hook&#8217;s Outliner, enable it using the Window &gt; Other Panels, you will see the Hook&#8217;s Outliner there just waiting to end your &#8220;salvation&#8221; &#8211; LOL sorry for my early morning sarcasm.</p>
<p>Look what happens after opening the panel.</p>
<p style="text-align: center;"><a href="http://www.isgoodstuff.com/wp-content/uploads/2011/02/wondersofHook.png"><img class="aligncenter size-full wp-image-1753" style="border: 1px gray solid;" title="wondersofHook" src="http://www.isgoodstuff.com/wp-content/uploads/2011/02/wondersofHook.png" alt="" width="580" height="364" /></a>Hook&#8217;s Outliner &#8211; List all your shapes, graphics, movieclips and even tells you where are they located in layer names.</p>
<p style="text-align: center;">Not to even mentioned the Library it is associated with as well as their classes.</p>
<p>Now isn&#8217;t that cool?</p>
<p>What are you waiting for <strong><a href="http://labs.byhook.com/2009/12/06/hook-picklist-flash-extension-panel/">go get it here</a></strong>?</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.isgoodstuff.com/2011/02/24/useful-flash-cs-extension-hooks-outliner/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Best IDE for Flash AS3</title>
		<link>http://www.isgoodstuff.com/2010/12/12/best-ide-for-flash-as3/</link>
		<comments>http://www.isgoodstuff.com/2010/12/12/best-ide-for-flash-as3/#comments</comments>
		<pubDate>Sun, 12 Dec 2010 12:21:00 +0000</pubDate>
		<dc:creator>Alex T.</dc:creator>
				<category><![CDATA[Good Stuff]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[IDE Tweaks]]></category>

		<guid isPermaLink="false">http://www.isgoodstuff.com/2010/12/24/best-ide-for-flash-as3/</guid>
		<description><![CDATA[<p><img src="http://www.isgoodstuff.com/wp-content/uploads/et_temp/FDLogo01-51675_243x200.png"/></p>The best third party IDE for Flash.]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.isgoodstuff.com/wp-content/uploads/et_temp/FDLogo01-51675_243x200.png"/></p><p>I’m sure you know by now after using Flash CS5 that, the IDE still doesn’t offer the view and comfort of scripting AS3 – especially, when coding using document classes style.</p>
<p style="text-align: center;"><a rel="lightbox" href="http://www.isgoodstuff.com/wp-content/uploads/2010/12/0a-interface.png"><img class="aligncenter" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="0a-interface" src="http://www.isgoodstuff.com/wp-content/uploads/2010/12/0a-interface_thumb.png" border="0" alt="0a-interface" width="450" height="336" /></a></p>
<p style="text-align: center;"><a rel="lightbox" href="http://www.isgoodstuff.com/wp-content/uploads/2010/12/CodeComplete.png"><img class="aligncenter" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="CodeComplete" src="http://www.isgoodstuff.com/wp-content/uploads/2010/12/CodeComplete_thumb.png" border="0" alt="CodeComplete" width="319" height="464" /></a></p>
<blockquote><p>So, what is the best third party IDE, I used to develop my games and project?</p></blockquote>
<p style="text-align: center;"><a rel="lightbox" href="http://www.isgoodstuff.com/wp-content/uploads/2010/12/FlashDevelop.png"><img class="aligncenter" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" title="FlashDevelop" src="http://www.isgoodstuff.com/wp-content/uploads/2010/12/FlashDevelop_thumb.png" border="0" alt="FlashDevelop" width="452" height="300" /></a></p>
<p>Yes, like the image says – Flash Develop IDE for windows. What’s so special you say? Well, here are some of the features listed below.</p>
<ul>
<li>FlashDevelop&#8217;s code completion works with your and others classes.</li>
<li>FlashDevelop completes the events that the object actually dispatches (as declared in the class metadatas).</li>
<li>The appropriate Event class will automatically be imported.</li>
<li>Has a nice docking interface that you can reorganize as you like.</li>
<li>Manage your project using the Project panel: create classes from templates, embed assets.</li>
<li>Support Flash CSs, Flex SDK, Mtasc/haXe+Swfmill are seamlessly integrated.</li>
<li>Click in the tree to jump in the code or open imported classes.</li>
</ul>
<blockquote><p>Last but not least, IT’S FREE – go get it <strong><a href="http://flashdevelop.org">here</a></strong>!</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.isgoodstuff.com/2010/12/12/best-ide-for-flash-as3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

