<?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>manewc &#187; manewc.com</title>
	<atom:link href="http://manewc.com/category/morgan-newcomb/feed/" rel="self" type="application/rss+xml" />
	<link>http://manewc.com</link>
	<description>iPhone, Flash, Flex, AIR, &#38; Web Development</description>
	<lastBuildDate>Sat, 31 Oct 2009 16:47:47 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Google Analytics/Tracking for Flash Elements</title>
		<link>http://manewc.com/2008/11/19/google-analyticstracking-for-flash-elements/</link>
		<comments>http://manewc.com/2008/11/19/google-analyticstracking-for-flash-elements/#comments</comments>
		<pubDate>Thu, 20 Nov 2008 01:53:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[manewc.com]]></category>

		<guid isPermaLink="false">http://manewc.com/?p=224</guid>
		<description><![CDATA[Just thought I would pass along this AS3 Library:
http://code.google.com/p/gaforflash/
]]></description>
			<content:encoded><![CDATA[<p>Just thought I would pass along this AS3 Library:</p>
<p><a href="http://code.google.com/p/gaforflash/">http://code.google.com/p/gaforflash/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://manewc.com/2008/11/19/google-analyticstracking-for-flash-elements/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex and Cairngorm</title>
		<link>http://manewc.com/2008/11/03/flex-and-cairngorm/</link>
		<comments>http://manewc.com/2008/11/03/flex-and-cairngorm/#comments</comments>
		<pubDate>Mon, 03 Nov 2008 13:44:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[manewc.com]]></category>

		<guid isPermaLink="false">http://manewc.com/?p=223</guid>
		<description><![CDATA[I know that I am behind the times with Flex and this is a continual learning process, but I wanted to learn more about MVC structures and Flex. I chose to explore Cairngorm and found this site as a great launching pad for learning more:
http://www.davidtucker.net/category/cairngorm/
I am not sure how it compares to other frameworks like [...]]]></description>
			<content:encoded><![CDATA[<p>I know that I am behind the times with Flex and this is a continual learning process, but I wanted to learn more about MVC structures and Flex. I chose to explore Cairngorm and found this site as a great launching pad for learning more:</p>
<p><a href="http://www.davidtucker.net/category/cairngorm/">http://www.davidtucker.net/category/cairngorm/</a></p>
<p>I am not sure how it compares to other frameworks like <a href="http://www.puremvc.org/">PureMVC</a> or <a href="http://osflash.org/projects/arp"><span class="caps">ARP</span></a> (or any others), I just randomly chose <a href="http://labs.adobe.com/wiki/index.php/Cairngorm">Cairngorm</a> to begin with, especially because David Tucker has great simple examples of usage.</p>
]]></content:encoded>
			<wfw:commentRss>http://manewc.com/2008/11/03/flex-and-cairngorm/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Flex Drag and Drop</title>
		<link>http://manewc.com/2008/09/26/flex-drag-and-drop/</link>
		<comments>http://manewc.com/2008/09/26/flex-drag-and-drop/#comments</comments>
		<pubDate>Fri, 26 Sep 2008 16:58:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[manewc.com]]></category>

		<guid isPermaLink="false">http://manewc.com/?p=205</guid>
		<description><![CDATA[Simple Drag and Drop demo

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_DragAndDrop_1492212225"
			class="flashmovie"
			width="700"
			height="300">
	<param name="movie" value="/projects/flex3/DragAndDrop/DragAndDrop.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/projects/flex3/DragAndDrop/DragAndDrop.swf"
			name="fm_DragAndDrop_1492212225"
			width="700"
			height="300">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>



    
        
    
        
			
            
        
   [...]]]></description>
			<content:encoded><![CDATA[<p>Simple Drag and Drop demo</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_DragAndDrop_1746121432"
			class="flashmovie"
			width="700"
			height="300">
	<param name="movie" value="/projects/flex3/DragAndDrop/DragAndDrop.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/projects/flex3/DragAndDrop/DragAndDrop.swf"
			name="fm_DragAndDrop_1746121432"
			width="700"
			height="300">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<pre name="code" class="c-sharp">
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="700" height="300" creationComplete="creationCompleteHandler();">
    <mx:Script>
        <![CDATA[
			private function creationCompleteHandler():void
			{
				srclist.dataProvider = ['Flash', 'Flex', 'AIR', 'Mac','Photoshop'];
				destlist.dataProvider = [];
			}
        ]]&gt;
    </mx:Script>
    <mx:Panel title="Drag from left to right" layout="horizontal">
        <mx:VBox width="50%">
			<mx:Label text="Box 1"/>
            <mx:List id="srclist" width="100%" height="180" allowMultipleSelection="true" dragEnabled="true" />
        </mx:VBox>
        <mx:VBox width="50%">
            <mx:Label text="Box 2"/>
            <mx:List id="destlist" width="100%" height="180" dropEnabled="true" />
        </mx:VBox>
    </mx:Panel>
</mx:Application>
</pre>
<p>My editor never liked to parse the Flex code, so here is a screenshot:</p>
<p><a href='http://manewc.com/wp-content/uploads/2008/09/draganddrop.gif'><img src="http://manewc.com/wp-content/uploads/2008/09/draganddrop.gif" alt="" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://manewc.com/2008/09/26/flex-drag-and-drop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Preloading Multiple Image &#8211; Demo</title>
		<link>http://manewc.com/2008/09/02/preloading-multiple-image-demo/</link>
		<comments>http://manewc.com/2008/09/02/preloading-multiple-image-demo/#comments</comments>
		<pubDate>Tue, 02 Sep 2008 17:36:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Image Effects]]></category>
		<category><![CDATA[Preloading]]></category>
		<category><![CDATA[manewc.com]]></category>

		<guid isPermaLink="false">http://manewc.com/?p=187</guid>
		<description><![CDATA[First, sorry. Awhile back I posted my code to preload multiple images that can be found here:
http://manewc.com/2008/05/16/preloading-multiple-images-with-actionscript/
I had a request to demo how the code works, so as I looked through the code I realized that one of the arrays should have been displayed as public instead of private to make the code more reusable. [...]]]></description>
			<content:encoded><![CDATA[<p>First, sorry. Awhile back I posted my code to preload multiple images that can be found here:</p>
<p><a href="http://manewc.com/2008/05/16/preloading-multiple-images-with-actionscript/">http://manewc.com/2008/05/16/preloading-multiple-images-with-actionscript/</a></p>
<p>I had a request to demo how the code works, so as I looked through the code I realized that one of the arrays should have been displayed as public instead of private to make the code more reusable. Anyways, I appended some code here to hopefully clarify some issues anyone may have encountered.</p>
<p>Here is the updated movie:</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_MultipleImagePreload_1440006669"
			class="flashmovie"
			width="700"
			height="333">
	<param name="movie" value="/projects/flash/MultipleImagePreload-Usage/MultipleImagePreload.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/projects/flash/MultipleImagePreload-Usage/MultipleImagePreload.swf"
			name="fm_MultipleImagePreload_1440006669"
			width="700"
			height="333">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>Here are the files that I used for this demo:<br />

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_FileDownload_2096712978"
			class="flashmovie"
			width="700"
			height="200">
	<param name="movie" value="/projects/flash/MultipleImagePreload-Usage/FileDownload.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/projects/flash/MultipleImagePreload-Usage/FileDownload.swf"
			name="fm_FileDownload_2096712978"
			width="700"
			height="200">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>Here is the updated code:</p>
<pre name="code" class="c-sharp">
package
{
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.events.Event;
	import flash.events.TimerEvent;
	import flash.utils.setInterval;
	import flash.utils.clearInterval;

	public class MultipleImagePreload extends Sprite
	{
		public var images:Array;
		public var chkLoaded:Boolean = false;

		private var imgArray:Array;

		// array of images.. onload event
		private var imgLoadArray:Array;

		// array of LoadImage class
		public var loadArray:Array;

		// variables for our timer events
		private var initLoadTimer:uint;
		private var preLoadTimer:uint;

		// variables for the preload process
		private var getTotalBits:Number; // the tally for the total bits
		private var imageTotalSize:Number;
		private var imagePreLoadSize:Number; // the tally for preloading

		public function MultipleImagePreload(images:Array)
		{
			imgArray = images;

			// Load in the images.
			loadArray = new Array();

			for ( var i:uint; i < images.length; i++ )
			{
				// load the image
				loadArray[i] = new LoadImage( imgArray[i] );

				// display the image to stage
				addChild ( loadArray[i] );

				// send them off the stage
				loadArray[i].x = -9999;
			}

			initLoadTimer = setInterval(onLoadImage, 500);
		}

		private function onLoadImage():void
		{
			var imgLoadArray = new Array();

			for ( var i:uint=0; i < imgArray.length; i++ )
			{
				getTotalBits = loadArray[i].getBits();

				if ( getTotalBits > 0 )
				{
					// check again.
					imgLoadArray[i] = loadArray[i];
				}
			}

			if ( imgLoadArray.length == imgArray.length )
			{

				clearInterval ( initLoadTimer );

				imageTotalSize = 0;

				// add up the size of all images
				for ( var u:uint=0; u < imgArray.length; u++ )
				{
					if ( loadArray[u].getBits() ) /* Safari is requiring this */
					{
						imageTotalSize += loadArray[u].getBits();

					}
				}

				Main(root).Message( "Total Size (bits): " + imageTotalSize + "\n" );

				// we now have recorded all file sizes.. now start the preloading
				preLoadTimer = setInterval(preLoadImage, 50);
			}
		}

		private var loadStat:Number;

		private function preLoadImage():void
		{
			imagePreLoadSize = 0;

			// add up the size of all images
			for ( var p:uint=0; p < imgArray.length; p++ )
			{
				imagePreLoadSize += loadArray[p].getBitsLoaded();
			}

			if ( ( imagePreLoadSize / imageTotalSize ) )
			{
				loadStat = Math.floor(100 * (imagePreLoadSize / imageTotalSize));

				if ( loadStat >= 100 )
				{
					// clear the timer
					clearInterval ( preLoadTimer );

					// set the boolean variable to true to notify all images are loaded
					chkLoaded = true;

					Main(root).Message ("100% Loaded\n");
				}
				else
				{
					Main(root).Message (Math.floor(100 * (imagePreLoadSize / imageTotalSize)) + "% Loaded\n");
				}
			}
		}
	}
}
</pre>
<p>LoadImage.as:</p>
<pre name="code" class="c-sharp">
package {
    import flash.display.Loader;
    import flash.display.Sprite;
    import flash.events.*;
    import flash.net.URLRequest;

    public class LoadImage extends Sprite {

		private var url:String;
		private var imageHolder:Sprite;
		public var bits:Number;
		public var bitsLoaded:Number;
		public var totalBits:Number;

        public function LoadImage(url:String) {
			var loader:Loader = new Loader();
            configureListeners(loader.contentLoaderInfo);

            var request:URLRequest = new URLRequest( url );
            loader.load(request);

			imageHolder = new Sprite();
			addChild ( imageHolder );
            imageHolder.addChild(loader);
        }

        private function configureListeners(dispatcher:IEventDispatcher):void {
			dispatcher.addEventListener(ProgressEvent.PROGRESS, progressHandler);
			dispatcher.addEventListener(Event.COMPLETE, completeHandler);
        }

        private function completeHandler(event:Event):void {
			Main(root).Message( "Image Load Event Complete\n" )
		}

		public function getBits()
		{
			return ( bits );
		}

		public function getBitsLoaded()
		{
			return ( bitsLoaded );
		}

        private function progressHandler(event:ProgressEvent):void {
			bitsLoaded = event.bytesLoaded;
			bits = event.bytesTotal;
        }

    }
}
</pre>
<p>.. and the main class, Main.as</p>
<pre name="code" class="c-sharp">
package {
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.events.Event;
	import flash.text.TextFormat;
	import flash.text.TextField;
	import fl.controls.TextArea;
	import fl.controls.ScrollPolicy;

	public class Main extends Sprite
	{
		// array of all images to be prelaoded before the movie begins:
		private var imgArray:Array;

		// the class to handle all the images
		private var imgPreload:MultipleImagePreload;

		//text area component
		private var output:TextArea;  

		public function Main()
		{
			stage.align = StageAlign.TOP_LEFT;
			stage.scaleMode = StageScaleMode.NO_SCALE;

			showOutput();

			init();
		}

		private function init():void
		{

			imgArray = new Array();
			imgArray[0] = "http://manewc.com/projects/flash/i/ski-ryan.jpg";
			imgArray[1] = "http://manewc.com/projects/flash/i/ski-ryan.jpg";

			imgPreload = new MultipleImagePreload(imgArray);
			addChild ( imgPreload );

			stage.addEventListener ( Event.ENTER_FRAME, checkPreload );

		}

		private function checkPreload(e:Event):void
		{
			if ( imgPreload.chkLoaded )
			{
				Message ( "\n====================\nALL IMAGES LOADED\n====================\n" );

				stage.removeEventListener ( Event.ENTER_FRAME, checkPreload );

				Message ( "\n\n" );
				Message ( "The way that this code works is that the images actually are
 positioned off the screen to allow you to position them in the viewable
stage when you need them" );
				Message ( "\n" );
				Message ( "You target each movie via the array:\n" );
				Message ( "\n" );
				Message ( "For Example:" );
				Message ( "\n" );
				Message	( "imgPreload.loadArray[0].x = 200;" );
				Message ( "imgPreload.loadArray[0].y = 0;" );
				Message ( "\n" );
				imgPreload.loadArray[0].x = 200;
				imgPreload.loadArray[0].y = 0;
				Message ( "Dimensions:" );
				Message ( "\n" );
				Message ( "------------------" );
				Message ( "\n" );
				Message ( "Width: " + imgPreload.loadArray[0].width );
				Message ( "\n" );
				Message ( "Height: " + imgPreload.loadArray[0].height );
			}
		}

		private function showOutput():void
        {
			output = new TextArea();
			output.verticalScrollPolicy = ScrollPolicy.ON;
			output.condenseWhite = true;
			output.setSize(200, stage.stageHeight);
			output.move(0, 0);
			addChild(output);
        }

		public function Message(msg:String):void
		{
			output.appendText ( msg );
		}

	}
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://manewc.com/2008/09/02/preloading-multiple-image-demo/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>APE Vectors and Collidable Walls</title>
		<link>http://manewc.com/2008/08/19/ape-vectors-and-collidable-walls/</link>
		<comments>http://manewc.com/2008/08/19/ape-vectors-and-collidable-walls/#comments</comments>
		<pubDate>Tue, 19 Aug 2008 16:57:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[APE - Actionscript Physics Engine]]></category>
		<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[manewc.com]]></category>

		<guid isPermaLink="false">http://manewc.com/?p=174</guid>
		<description><![CDATA[So I just added some walls to my little movie here and took out the KEY_UP handler to allow the circle to continuously move around the stage. To activate, simply hit an arrow key.

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_APEVectors_1137649984"
			class="flashmovie"
			width="700"
			height="700">
	<param name="movie" value="/projects/flash/APEVectors2/APEVectors.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/projects/flash/APEVectors2/APEVectors.swf"
			name="fm_APEVectors_1137649984"
			width="700"
			height="700">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>

package {
	import flash.display.Sprite;
	import flash.events.Event;
	import org.cove.ape.APEngine;
	import org.cove.ape.Vector;
	import org.cove.ape.CircleParticle;
	import org.cove.ape.Group;
	import flash.events.KeyboardEvent;
	import flash.ui.Keyboard;
	import flash.text.TextField;

	public class Main extends Sprite
	{
		private	var cp:Circle = new [...]]]></description>
			<content:encoded><![CDATA[<p>So I just added some walls to my little movie here and took out the KEY_UP handler to allow the circle to continuously move around the stage. To activate, simply hit an arrow key.</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_APEVectors_1510511290"
			class="flashmovie"
			width="700"
			height="700">
	<param name="movie" value="/projects/flash/APEVectors2/APEVectors.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/projects/flash/APEVectors2/APEVectors.swf"
			name="fm_APEVectors_1510511290"
			width="700"
			height="700">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<pre name="code" class="c-sharp">
package {
	import flash.display.Sprite;
	import flash.events.Event;
	import org.cove.ape.APEngine;
	import org.cove.ape.Vector;
	import org.cove.ape.CircleParticle;
	import org.cove.ape.Group;
	import flash.events.KeyboardEvent;
	import flash.ui.Keyboard;
	import flash.text.TextField;

	public class Main extends Sprite
	{
		private	var cp:Circle = new Circle( stage.stageWidth / 2, stage.stageHeight / 2 );
		private var walls:Walls = new Walls( stage.stageWidth, stage.stageHeight );

		public function Main()
		{
			APEngine.init(1/4);

			// set up the default diplay container
			APEngine.container = this;
			APEngine.addMasslessForce(new Vector(0,0));

			APEngine.addGroup(cp);
			APEngine.addGroup(walls);

			cp.addCollidable ( walls );

			stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
            addEventListener(Event.ENTER_FRAME, run);
		}

		private function run(e:Event):void
		{
			APEngine.step();
			APEngine.paint();
		}

		private function keyDownHandler(k:KeyboardEvent):void
		{
			if (k.keyCode == Keyboard.UP) {
				cp.cp.velocity = (new Vector(0, -5));
			} else if (k.keyCode == Keyboard.DOWN) {
				cp.cp.velocity = (new Vector(0, 5));
			} else if (k.keyCode == Keyboard.RIGHT) {
				cp.cp.velocity = (new Vector(5, 0));
			} else if (k.keyCode == Keyboard.LEFT) {
				cp.cp.velocity = (new Vector(-5, 0));
			}
		}
	}
}
</pre>
<p>The Circle class:</p>
<pre name="code" class="c-sharp">
package
{
	import org.cove.ape.Group;
	import org.cove.ape.CircleParticle;
	import org.cove.ape.Vector;

	public class Circle extends Group
	{
		public var cp:CircleParticle;

		public function Circle(x:uint, y:uint)
		{
			cp = new CircleParticle(x, y, 5, false, 3, .8);
			cp.setStyle(0, 0, 0, Math.random() * 0xffffff);
			addParticle(cp);
		}
	}
}
</pre>
<p>The Wall class:</p>
<pre name="code" class="c-sharp">
package
{
	import org.cove.ape.Group;
	import org.cove.ape.RectangleParticle;  

	public class Walls extends Group
	{

		public function Walls(bw:Number, bh:Number)
		{
			// top
			var t:RectangleParticle = new RectangleParticle(bw/2, 0, bw, 10, 0, true);
			addParticle(t);

			// this is the bottom
			var b:RectangleParticle = new RectangleParticle(bw/2, bh, bw, 100, 0, true);
			addParticle(b);

			// left
			var l:RectangleParticle = new RectangleParticle(0, bh / 2, 10, bh, 0, true);
			addParticle(l);  

			// right
			var r:RectangleParticle = new RectangleParticle(bw, bh / 2, 10, bh, 0, true);
			addParticle(r);
		}
	}
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://manewc.com/2008/08/19/ape-vectors-and-collidable-walls/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fireworks and On Vacation</title>
		<link>http://manewc.com/2008/07/03/on-vacation/</link>
		<comments>http://manewc.com/2008/07/03/on-vacation/#comments</comments>
		<pubDate>Thu, 03 Jul 2008 18:21:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[manewc.com]]></category>

		<guid isPermaLink="false">http://manewc.com/?p=146</guid>
		<description><![CDATA[&#8220;See&#8221; you all late next week &#8211; Have a good holiday! I modified some code from Keith Peter&#8217;s book to create the animation, you can check out his book here: Foundation Actionscript 3.0 Animation: Making Things Move!, to create this fireworks animation display.

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_Fireworks_814497763"
			class="flashmovie"
			width="700"
			height="700">
	<param name="movie" value="/projects/flash/Fireworks/Fireworks.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/projects/flash/Fireworks/Fireworks.swf"
			name="fm_Fireworks_814497763"
			width="700"
			height="700">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
]]></description>
			<content:encoded><![CDATA[<p>&#8220;See&#8221; you all late next week &#8211; Have a good holiday! I modified some code from Keith Peter&#8217;s book to create the animation, you can check out his book here: <a href="http://www.amazon.com/gp/product/1590597915?ie=UTF8&#038;tag=gx-20&#038;linkCode=as2&#038;camp=1789&#038;creative=9325&#038;creativeASIN=1590597915">Foundation Actionscript 3.0 Animation: Making Things Move!</a><img src="http://www.assoc-amazon.com/e/ir?t=gx-20&#038;l=as2&#038;o=1&#038;a=1590597915" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />, to create this fireworks animation display.</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_Fireworks_1041110118"
			class="flashmovie"
			width="700"
			height="700">
	<param name="movie" value="/projects/flash/Fireworks/Fireworks.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/projects/flash/Fireworks/Fireworks.swf"
			name="fm_Fireworks_1041110118"
			width="700"
			height="700">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
]]></content:encoded>
			<wfw:commentRss>http://manewc.com/2008/07/03/on-vacation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Filling BitmapData Colors with an alternate color with the floodFill Method</title>
		<link>http://manewc.com/2008/06/30/filling-bitmapdata-colors-with-an-alternate-color-with-the-floodfill-method/</link>
		<comments>http://manewc.com/2008/06/30/filling-bitmapdata-colors-with-an-alternate-color-with-the-floodfill-method/#comments</comments>
		<pubDate>Mon, 30 Jun 2008 17:46:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[manewc.com]]></category>

		<guid isPermaLink="false">http://manewc.com/?p=143</guid>
		<description><![CDATA[I wanted to learn more about bitmap data in flash and came across the floodFill() method. It basically will replace a color with one you assign it. In the demo the original color is a light blue (rgb 003366) and when you click the stage the square will change colors via the floodFill method.

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_FloodFillExample_1517239678"
			class="flashmovie"
			width="400"
			height="300">
	<param name="movie" value="/projects/flash/FloodFill/FloodFillExample.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/projects/flash/FloodFill/FloodFillExample.swf"
			name="fm_FloodFillExample_1517239678"
			width="400"
			height="300">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>]]></description>
			<content:encoded><![CDATA[<p>I wanted to learn more about bitmap data in flash and came across the floodFill() method. It basically will replace a color with one you assign it. In the demo the original color is a light blue (rgb 003366) and when you click the stage the square will change colors via the floodFill method.</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_FloodFillExample_1440761104"
			class="flashmovie"
			width="700"
			height="700">
	<param name="movie" value="/projects/flash/FloodFill/FloodFillExample.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/projects/flash/FloodFill/FloodFillExample.swf"
			name="fm_FloodFillExample_1440761104"
			width="700"
			height="700">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<pre name="code" class="c-sharp">
package
{
	import flash.display.Sprite;
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.geom.Rectangle;
	import flash.events.MouseEvent;

	public class FloodFillExample extends Sprite
	{
		private var _bmd:BitmapData;
		private var _rect:Rectangle;
		private var _bm:Bitmap;

		public function FloodFillExample()
		{
			_bmd = new BitmapData(stage.stageWidth, stage.stageHeight, false, 0x00cccccc);

			_rect = new Rectangle(0, 0, stage.stageWidth/2, stage.stageHeight/2);
			_bmd.fillRect(_rect, 0x00336699);

			AddBm();

			stage.addEventListener ( MouseEvent.MOUSE_DOWN, Flood );
		}

		private function Flood( e:MouseEvent )
		{
			//  public function floodFill(x:int, y:int, color:uint):void
			_bmd.floodFill(0, 0, Math.random() * 0xffffff);

			AddBm();
		}

		private function AddBm():void
		{
			var _bm:Bitmap = new Bitmap(_bmd);
			addChild(_bm);
		}
	}
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://manewc.com/2008/06/30/filling-bitmapdata-colors-with-an-alternate-color-with-the-floodfill-method/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Combining Arrays with the Array.Concat Method</title>
		<link>http://manewc.com/2008/06/04/combining-arrays-with-the-arrayconcat-method/</link>
		<comments>http://manewc.com/2008/06/04/combining-arrays-with-the-arrayconcat-method/#comments</comments>
		<pubDate>Wed, 04 Jun 2008 19:54:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Arrays]]></category>
		<category><![CDATA[manewc.com]]></category>

		<guid isPermaLink="false">http://manewc.com/?p=122</guid>
		<description><![CDATA[
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_ArrayConcat_1184483457"
			class="flashmovie"
			width="700"
			height="200">
	<param name="movie" value="/projects/flash/ArrayConcat/ArrayConcat.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/projects/flash/ArrayConcat/ArrayConcat.swf"
			name="fm_ArrayConcat_1184483457"
			width="700"
			height="200">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
The Actionscript Document Class:

package
{
	import flash.display.Sprite;
	import fl.controls.TextArea;
	import fl.controls.ScrollPolicy;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFieldType;
	import flash.text.TextFormat;

	public class ArrayConcat extends Sprite
	{
		private var output:TextArea;
		private var ArrOne:Array;
		private var ArrTwo:Array;
		private var ConcatArrays:Array;

		public function ArrayConcat()
		{
			init()
		}

		private function init():void
		{
			// display our output field
			Output();

			// set up the arrays
			ArrOne = new Array(1, 2, 3);
			ArrTwo = new Array(4, 5, 6);
			ConcatArrays = ArrOne.concat(ArrTwo);

			// display the output
			msg ( [...]]]></description>
			<content:encoded><![CDATA[
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_ArrayConcat_1250595901"
			class="flashmovie"
			width="700"
			height="200">
	<param name="movie" value="/projects/flash/ArrayConcat/ArrayConcat.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/projects/flash/ArrayConcat/ArrayConcat.swf"
			name="fm_ArrayConcat_1250595901"
			width="700"
			height="200">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>The Actionscript Document Class:</p>
<pre name="code" class="c-sharp">
package
{
	import flash.display.Sprite;
	import fl.controls.TextArea;
	import fl.controls.ScrollPolicy;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFieldType;
	import flash.text.TextFormat;

	public class ArrayConcat extends Sprite
	{
		private var output:TextArea;
		private var ArrOne:Array;
		private var ArrTwo:Array;
		private var ConcatArrays:Array;

		public function ArrayConcat()
		{
			init()
		}

		private function init():void
		{
			// display our output field
			Output();

			// set up the arrays
			ArrOne = new Array(1, 2, 3);
			ArrTwo = new Array(4, 5, 6);
			ConcatArrays = ArrOne.concat(ArrTwo);

			// display the output
			msg ( "OUTPUT" );
			msg ( "-----------------------------------" );
			msg ( "ArrOne: " + ArrOne );
			msg ( "ArrTwo: " + ArrTwo );
			msg ( "Concatenation....." );
			msg ( "ConcatArrays: " + ConcatArrays );
			msg ( "-----------------------------------" );
		}

		// UI elements

		public function Output():void
		{
			// Small Black Text Formatting
			var smallBlackFormat:TextFormat = new TextFormat();
			smallBlackFormat.font = "Arial";
			smallBlackFormat.color = 0x000000;
            smallBlackFormat.size = 10;
            smallBlackFormat.underline = false;

        	// output TextField
			output = new TextArea();
           	output.verticalScrollPolicy = ScrollPolicy.ON;
           	output.condenseWhite = true;
           	output.setSize(stage.stageWidth, stage.stageHeight);
           	output.move(0,0);
           	addChild(output);
        }

		public function msg(m:String):void
		{
			output.appendText (m + "\n");
		}

	}
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://manewc.com/2008/06/04/combining-arrays-with-the-arrayconcat-method/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Preloading Multiple Images with Actionscript</title>
		<link>http://manewc.com/2008/05/16/preloading-multiple-images-with-actionscript/</link>
		<comments>http://manewc.com/2008/05/16/preloading-multiple-images-with-actionscript/#comments</comments>
		<pubDate>Fri, 16 May 2008 16:37:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Image Effects]]></category>
		<category><![CDATA[Preloading]]></category>
		<category><![CDATA[manewc.com]]></category>

		<guid isPermaLink="false">http://manewc.com/2008/05/16/preloading-multiple-images-with-actionscript/</guid>
		<description><![CDATA[Please view my updated code
One of my new projects involves a lot of imagery so I decided to write a class that I could send it an array of images and preload them with a loading bar. The code below doesn&#8217;t have a loading bar, but if you trace out the code you can see [...]]]></description>
			<content:encoded><![CDATA[<p><strong><a href="http://manewc.com/2008/09/02/preloading-multiple-image-demo/">Please view my updated code</a></strong></p>
<p>One of my new projects involves a lot of imagery so I decided to write a class that I could send it an array of images and preload them with a loading bar. The code below doesn&#8217;t have a loading bar, but if you trace out the code you can see how you can integrate a loading animation to the code. Here is what I have that works for what I need, although I would like to go through it to see if I can make it more efficient.</p>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="fm_MultipleImagePreload_708284261"
			class="flashmovie"
			width="400"
			height="400">
	<param name="movie" value="/projects/flash/MultipleImagePreload/MultipleImagePreload.swf" />
	<!--[if !IE]>-->
	<object	type="application/x-shockwave-flash"
			data="/projects/flash/MultipleImagePreload/MultipleImagePreload.swf"
			name="fm_MultipleImagePreload_708284261"
			width="400"
			height="400">
	<!--<![endif]-->
		
	<!--[if !IE]>-->
	</object>
	<!--<![endif]-->
</object>
<p>Here is the Main Document Class:</p>
<pre name="code" class="c-sharp">
package {
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.events.Event;
	import flash.text.TextFormat;
	import flash.text.TextField;
	import fl.controls.TextArea;
	import fl.controls.ScrollPolicy;

	public class Main extends Sprite
	{
		// array of all images to be prelaoded before the movie begins:
		private var imgArray:Array;

		// the class to handle all the images
		private var imgPreload:MultipleImagePreload;

		//text area component
		private var output:TextArea;  

		public function Main()
		{
			stage.align = StageAlign.TOP_LEFT;
			stage.scaleMode = StageScaleMode.NO_SCALE;

			showOutput();

			init();
		}

		private function init():void
		{

			imgArray = new Array();
			imgArray[0] = "http://manewc.com/projects/flash/i/infused-blackraspberry.png";
			imgArray[1] = "http://manewc.com/projects/flash/i/infused-blueberry.png";
			imgArray[2] = "http://manewc.com/projects/flash/i/infused-coconut.png";
			imgArray[3] = "http://manewc.com/projects/flash/i/infused-lemonlime.png";
			imgArray[4] = "http://manewc.com/projects/flash/i/infused-peach.png";
			imgArray[5] = "http://manewc.com/projects/flash/i/infused-pineappleorange.png";
			imgArray[6] = "http://manewc.com/projects/flash/i/infused-strawberry.png";

			imgPreload = new MultipleImagePreload(imgArray);
			addChild ( imgPreload );

			stage.addEventListener ( Event.ENTER_FRAME, checkPreload );

		}

		private function checkPreload(e:Event):void
		{
			if ( imgPreload.chkLoaded )
			{
				Message ( "\n====================\nALL IMAGES LOADED\n====================\n" );

				stage.removeEventListener ( Event.ENTER_FRAME, checkPreload );
			}
		}

		private function showOutput():void
        {
			output = new TextArea();
			output.verticalScrollPolicy = ScrollPolicy.ON;
			output.condenseWhite = true;
			output.setSize(stage.stageWidth, stage.stageHeight);
			output.move(0, 0);
			addChild(output);
        }

		public function Message(msg:String):void
		{
			output.appendText ( msg );
		}

	}
}</pre>
<p>The class that is the Preloader</p>
<pre name="code" class="c-sharp">
package
{
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.events.Event;
	import flash.events.TimerEvent;
	import flash.utils.setInterval;
	import flash.utils.clearInterval;

	public class MultipleImagePreload extends Sprite
	{
		public var images:Array;
		public var chkLoaded:Boolean = false;

		private var imgArray:Array;

		// array of images.. onload event
		private var imgLoadArray:Array;

		// array of LoadImage class
		private var loadArray:Array;

		// variables for our timer events
		private var initLoadTimer:uint;
		private var preLoadTimer:uint;

		// variables for the preload process
		private var getTotalBits:Number; // the tally for the total bits
		private var imageTotalSize:Number;
		private var imagePreLoadSize:Number; // the tally for preloading

		public function MultipleImagePreload(images:Array)
		{
			imgArray = images;

			// Load in the images.
			loadArray = new Array();

			for ( var i:uint; i &lt; images.length; i++ )
			{
				// load the image
				loadArray[i] = new LoadImage( imgArray[i] );

				// display the image to stage
				addChild ( loadArray[i] );

				// send them off the stage
				loadArray[i].x = -9999;
			}

			initLoadTimer = setInterval(onLoadImage, 500);
		}

		private function onLoadImage():void
		{
			var imgLoadArray = new Array();

			for ( var i:uint=0; i &lt; imgArray.length; i++ )
			{
				getTotalBits = loadArray[i].getBits();

				if ( getTotalBits &gt; 0 )
				{
					// check again.
					imgLoadArray[i] = loadArray[i];
				}
			}

			if ( imgLoadArray.length == imgArray.length )
			{

				clearInterval ( initLoadTimer );

				imageTotalSize = 0;

				// add up the size of all images
				for ( var u:uint=0; u &lt; imgArray.length; u++ )
				{
					if ( loadArray[u].getBits() ) /* Safari is requiring this */
					{
						imageTotalSize += loadArray[u].getBits();

					}
				}

				Main(root).Message( "Total Size (bits): " + imageTotalSize + "\n" );

				// we now have recorded all file sizes.. now start the preloading
				preLoadTimer = setInterval(preLoadImage, 50);
			}
		}

		private var loadStat:Number;

		private function preLoadImage():void
		{
			imagePreLoadSize = 0;

			// add up the size of all images
			for ( var p:uint=0; p &lt; imgArray.length; p++ )
			{
				imagePreLoadSize += loadArray[p].getBitsLoaded();
			}

			if ( ( imagePreLoadSize / imageTotalSize ) )
			{
				loadStat = Math.floor(100 * (imagePreLoadSize / imageTotalSize));

				if ( loadStat &gt;= 100 )
				{
					// clear the timer
					clearInterval ( preLoadTimer );

					// set the boolean variable to true to notify all images are loaded
					chkLoaded = true;

					Main(root).Message ("100% Loaded\n");
				}
				else
				{
					Main(root).Message (Math.floor(100 * (imagePreLoadSize / imageTotalSize)) + "% Loaded\n");
				}
			}
		}
	}
}</pre>
<p>The class that will load in the image</p>
<pre name="code" class="c-sharp">
package {
    import flash.display.Loader;
    import flash.display.Sprite;
    import flash.events.*;
    import flash.net.URLRequest;

    public class LoadImage extends Sprite {

		private var url:String;
		private var imageHolder:Sprite;
		public var bits:Number;
		public var bitsLoaded:Number;
		public var totalBits:Number;

        public function LoadImage(url:String) {
			var loader:Loader = new Loader();
            configureListeners(loader.contentLoaderInfo);

            var request:URLRequest = new URLRequest( url );
            loader.load(request);

			imageHolder = new Sprite();
			addChild ( imageHolder );
            imageHolder.addChild(loader);
        }

        private function configureListeners(dispatcher:IEventDispatcher):void {
			dispatcher.addEventListener(ProgressEvent.PROGRESS, progressHandler);
			dispatcher.addEventListener(Event.COMPLETE, completeHandler);
        }

        private function completeHandler(event:Event):void {
			Main(root).Message( "Image Load Event Complete\n" )
		}

		public function getBits()
		{
			return ( bits );
		}

		public function getBitsLoaded()
		{
			return ( bitsLoaded );
		}

        private function progressHandler(event:ProgressEvent):void {
			bitsLoaded = event.bytesLoaded;
			bits = event.bytesTotal;
        }

    }
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://manewc.com/2008/05/16/preloading-multiple-images-with-actionscript/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>The Best Flash Animation</title>
		<link>http://manewc.com/2008/04/26/the-best-flash-animation/</link>
		<comments>http://manewc.com/2008/04/26/the-best-flash-animation/#comments</comments>
		<pubDate>Sat, 26 Apr 2008 17:46:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[manewc.com]]></category>

		<guid isPermaLink="false">http://manewc.com/2008/04/26/the-best-flash-animation/</guid>
		<description><![CDATA[This one wins:
http://www.adobe.com/jp/events/cs3_web_edition_tour/swfs/perform.swf
]]></description>
			<content:encoded><![CDATA[<p>This one wins:</p>
<p><a href="http://www.adobe.com/jp/events/cs3_web_edition_tour/swfs/perform.swf">http://www.adobe.com/jp/events/cs3_web_edition_tour/swfs/perform.swf</a></p>
]]></content:encoded>
			<wfw:commentRss>http://manewc.com/2008/04/26/the-best-flash-animation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
