Create buttons using AS3 in Adobe CS3 and CS4

How to make a button work in AS3 like AS2

The old way of making a button in AS2 would look similar to this:

btnMC.onRelease = function() {
getURL("http://www.newsourcemedia.com");
};

The new way of making buttons work In AS3 (ActionScript 3.0) is a bit more lines of code. So create a movie clip of a button and give it the instance name of “btnMC” and paste the following code in your actionscript panel.

btnMC.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
function onMouseDown(event:MouseEvent):void {
navigateToURL(new URLRequest("http://www.newsourcemedia.com/"));
}

2 thoughts on “Create buttons using AS3 in Adobe CS3 and CS4

  1. Hi there, could you alter the get URL function so the button either loads an extneral SWF into an MC / goes to a frame within the root SWF?

Leave a Reply

Your email address will not be published. Required fields are marked *