AS3 Buttons

Make anything a button in as3, just give it an instance name.

//AS3 button code going to a url

//btWhatever is the instance name of the the images that I want to make a button
btWhatever.addEventListener(MouseEvent.CLICK,onMouseClick);

// if you want a hand cursor
btWhatever.buttonMode = true;
btWhatever.useHandCursor = true;
function onMouseClick(e:MouseEvent):void
{
var request:URLRequest = new URLRequest("Graphicmuse.com");
navigateToURL(request, "_blank");
}

this button will go to a frame or label


//basic as3 button goto frame number
button.addEventListener(MouseEvent.CLICK, clickFunction);

// if you want a hand cursor
button.buttonMode = true;
button.useHandCursor = true;

function clickFunction(evt:MouseEvent):void {
gotoAndStop(2);
}

More work than before, but now you know.

Popularity: 36% [?]

line
Graphicmuse Design copyright 2009