PDA

View Full Version : Loading swfs into a container



mariuskatz
June 3rd, 2008, 02:02 AM
I am trying to load various swf into one container (instancename:holder).

In As2 i used to declare a variable, change its properties via buttons and load the swf using the MovieLoaderClass into the holder clip.

what is cool about this is the fact that when you load a different movie or a website category, firstly the exisiting movie exits and then the new is loaded which leads to smooth transitions.

i used the MovieLoaderClass heavily which doesn't work in AS3.

loading a swf in AS3 is straight forward but cannot seem to get my head around loading swf via a variable

Pier25
June 3rd, 2008, 04:50 AM
Here's a function I did this weekend to load an external swf. If you want to load another one simply call the function again with another url.



public function cargar_archivo(url:String,scope:Object):void{
var loader:Loader = new Loader();
var archivo:URLRequest = new URLRequest(url);

loader.load(archivo);
loader.contentLoaderInfo.addEventListener(Event.IN IT, cargado);

function cargado(evento:Event):void{
setTimeout(init_archivo,2000,evento.target.content );
evento.target.content.alpha = 0;
evento.target.content.stop();
scope.addChild(evento.target.content);
}

}

Alex Lexcuk
June 3rd, 2008, 03:30 PM
http://kind-armadillo.pochta.ru/FlaAC3/curve.swf
http://kind-armadillo.pochta.ru/FlaAC3/loadSWF.swf
http://kind-armadillo.pochta.ru/FlaAC3/loadSWF.rar

http://kind-armadillo.pochta.ru/fla/osc.swf
http://kind-armadillo.pochta.ru/FlaAC3/RotateSWF.swf
http://kind-armadillo.pochta.ru/FlaAC3/RotateSWF.rar