Skip to main content
April 7, 2013
Question

AS3 button question swfaddress

  • April 7, 2013
  • 1 reply
  • 425 views

I am trying to transition from as2 to as3 its been going very slow I have added as3 swfadress successfully my problem is that I dont want to use movieclips instead of buttons here is what i have

i have this on frame 2

// SWFAddress actions
function btnClick(e:MouseEvent) {
SWFAddress.setValue(e.target.deepLink);
}
function btnRollOver(e:MouseEvent) {
SWFAddress.setStatus(e.target.deepLink);
}
function btnRollOut(e:MouseEvent) {
SWFAddress.resetStatus();
}

// SWFAddress handling
function handleSWFAddress(e:SWFAddressEvent) {
try {
  if (currentFrame == 2 && e.value == '/') {
   play();
  } else {
   gotoAndStop('$' + e.value);
  }
} catch(err) {
  gotoAndStop('$/error/');
}

}
SWFAddress.addEventListener(SWFAddressEvent.CHANGE, handleSWFAddress);
stop();

then in the movie clips i have the below code

this.deepLink = '/home/';

this.buttonMode = true;

this.addEventListener(MouseEvent.CLICK, (parent as MovieClip).btnClick);

this.addEventListener(MouseEvent.ROLL_OVER, (parent as MovieClip).btnRollOver);

this.addEventListener(MouseEvent.ROLL_OUT, (parent as MovieClip).btnRollOut);

however using this setup I would like to use buttons instead of movieclips how do i accomplish this because in as3 you cannot add code in a button

This topic has been closed for replies.

1 reply

Ned Murphy
Legend
April 7, 2013

Why do you want to use buttons instead of movieclips?  What feature are you looking to utilize that movieclips don't support?  Have you considered using a button inside of a movieclip?

April 7, 2013

Well thats a good question and as i look at my issue i need to face it instead of running I want to animated it and found some documents on how to but my biggest issue is using swf address  my external buttons dont work now they do nothing