How to use button to load another swf file

BenjaminWong
BenjaminWong used Ask the Experts™
on
Hi Expert, I am new to CS4 but I am learning.  I have created a simple button with intention to use it to load another swf file. I have used the following AS3 scrips but it did not work.  Plase help:

function setupEvents() {
      //associate events with event handlers
      myButton.addEventListener(MouseEvent.CLICK,clickButtonHandler);
      myButton.addEventListener(MouseEvent.CLICK,release);
}

setupEvents();
function clickButtonHandler(e:MouseEvent) {
trace("Clicked Button");
}


function release(e:MouseEvent):void {
      
trace("I am here");
var loader.load=new loader();
addChild(loader);
load("Question1exp.swf",1);



}
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
this code should do it

 
function newvid(event:MouseEvent) {
trace("you clicked me");
var loadit = new Loader();
addChild(loadit);
loadit.load(new URLRequest("thevid.swf"));
}
my_mc.addEventListener(MouseEvent.MOUSE_DOWN, newvid);

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial