Create a new fla file and name it Loaderclass.fla. Place the fla in the same folder as the biz folder. Have an 100 frames animation in the library with the class name "LoaderBar". Then create an Actionscript file, name it Loaderclass.as and place this script. Replace the name "testmovie.swf" with the path for any image or movie of your choice and test movie.
package
{
import flash.display.Sprite;
import flash.display.*;
import flash.events.*;
import biz.flashscript.utils.LoaderClass;
import flash.events.*;
public class Loaderclass extends Sprite
{
private var mc:Sprite;
public var message:String;
public static const LOAD_FIN:String = "loadFin";
public function Loaderclass ():void
{
var myLoader:LoaderClass = new LoaderClass();
var url:String = "testmovie.swf";//HOME.swf
mc=new Sprite();
var cont:Container=new Container();
cont.mouseChildren = false;
addChild (cont);
var cl:Clip=new Clip();
cl.name = "CLIP";
cont.addChild (cl);
cont.addEventListener (MouseEvent.CLICK,mcHandler);
addEventListener (LOAD_FIN,lf);
myLoader.initLoader (url, completed,this,"LoaderBar",10000, false);
}
private function completed (e:Event,a:Object,b:Object,c:Object):void
{
e.target.content.width = 550;
trace ("A: "+e.currentTarget.content.parent);
var mm:Object = e.target.content;
dispatchEvent (new Event(LOAD_FIN));
}
private function mcHandler (event:MouseEvent):void
{
trace (event.target);
}
private function lf (ev:Event):void
{
var myLoad:Loader = Loader(getChildByName("urlLoader"));
trace ("finished");
trace (getChildByName("urlLoader"));
myLoad.unloadAndStop ();
}
}
}
|