Sunday, April 13, 2008

Loading AS1 / AS2 Flash Movies Dynamically with AS3

So, I could not find any good code snippets for loading a older AS2 Flash Movie via AS3, but several people talked about it being possible.

Also I have been using BulkLoader for loading assets into Flash and there is not a code snippet on that site (that I could find) to load a older movie from a url - there was a method that indicated it could be done. BulkLoader is a great bulk load library (open-source): http://code.google.com/p/bulk-loader/

So I finally got the right mix down and figured I would throw the class wrapper that does it out to the wild and maybe save someone a few minutes. Leave me a comment if you found the snippet useful!

package com.netrecon.test
{
import flash.display.*;
import flash.text.*;
import flash.net.URLRequest;
import flash.events.*;
import br.com.stimuli.loading.*; //BulkLoader


public class OldMovie extends Sprite
{

var loader : BulkLoader = new BulkLoader("test");
var movie:AVM1Movie = null;
var url:String =
"http://yourURL.com/YourOldMovie.swf";

public function OldMovie():void
{
// loader loads AVM1 movie
loader.add(url);


loader.addEventListener(BulkLoader.PROGRESS, onProgress);
loader.addEventListener(BulkLoader.COMPLETE, onComplete);
loader.start();
}

// bulk loader events
function onProgress(evt : BulkProgressEvent) : void{
trace(evt.percentLoaded);
}


function onComplete(evt : Event) : void
{
var movie = loader.getAVM1Movie(url);
addChild(movie);
trace("loaded old movie swf from server.");
}
//end bulk loader events
}
}


-Rask
Austin, TX - Flash Game Development
http://www.net-recon.com

Tuesday, April 8, 2008

Austin Flash Game Development

We have been working with the SmartFoxServer working through the architecture and testing various scenarios for chat and other player interaction / handling.

It is a pretty good product - I think the possibilities for future versions and extensions are pretty broad as casual gaming / advergaming / branded entertainment / social media keep converging.

In case you are looking for more information on multi-player servers for Flash games, definitely check out SmartFoxServer and Electro-Server. Both seem pretty stable. I know there are other products out there, but these seem to have a pretty good community following so far.

It would be great to hear if anyone has had any good/bad experiences with these products or if anyone recommends cool extensions/complimentary libraries/other platforms worth checking out!

-Rask
Austin, TX
http://www.net-recon.com