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
Subscribe to:
Post Comments (Atom)
3 comments:
hi thanks for posting this will b very beneficial for the flash peoples.
broadcast satellite services
Thanks for the post
Woww..i really learned from your blog...
website design perth
Post a Comment