NewSourceMedia on Facebook

Create buttons using AS3 in Adobe CS3 and CS4

Share Bookmark and Share

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/"));
}

Please rate this post by clicking a star:

(5 votes, average: 4.80 out of 5)

One Response to “Create buttons using AS3 in Adobe CS3 and CS4”

Leave a Reply