[AS3]using buttons to load external swf
Hi, just started using AS3 and i would like some help.
I have four button on my main movie, which basically will load an external swf when pressed. Right now, i'm able to load the first movie directly using this code
Code:
prBut.addEventListener(MouseEvent.CLICK, onClick);
srBut.addEventListener(MouseEvent.CLICK, onClick);
tm.addEventListener(MouseEvent.CLICK, onClick);
conBut.addEventListener(MouseEvent.CLICK, onClick);
function onClick(e:MouseEvent):void
{
trace(e.target.name + "has been pressed");
}
var holder:MovieClip;
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
loader.load(new URLRequest("home.swf"));
function onComplete(e:Event):void
{
holder = MovieClip(e.target.content);
holder.x = 2;
holder.y = 176;
addChild(holder);
}
Now, how do i use buttons to load the movies?
Can someone help me plz