views:

169

answers:

2

How do I convert these AS2 Buttons to AS3?

on (press) {
    nextFrame();
}
on (press) {
    prevFrame();
}
+2  A: 
import flash.events.MouseEvent;

this.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);

public function mouseDownHandler(event:MouseEvent):void{
    nextFrame();
}

But you should probably also read this to learn how the event model has changed:

http://www.flashvalley.com/fv_tutorials/mouse_events_in_actionscript_3.0/

quoo
+1  A: 

AS3 has changes a fair bit if you are used to "on(press)" button code.

This is the perfect video tutorial for you: Getting Started with AS3 - Simple Buttons. It explains the basics of buttons in AS3 for people who are coming from AS2. This should give you a good overview.

TandemAdam