PDA

View Full Version : Buttons in CS3?



Pattt
August 9th, 2007, 11:54 AM
How do I make a simple onRelease for a button (root.b1) in CS3?
Thanks!

senocular
August 9th, 2007, 11:59 AM
What version of ActionScript?

Pattt
August 9th, 2007, 12:48 PM
AS3, of course! :fab:
Please help!

senocular
August 9th, 2007, 12:49 PM
CS3 supports AS1, AS2, and AS3 ;)
Moving to AS3 forum

rondog
August 9th, 2007, 12:50 PM
AS3 uses event listeners so it would look something like this


myButton.addEventListener(MouseEvent.CLICK,myFunct ion);

function myFunction(event:MouseEvent):void {
//put your function here
}

senocular
August 9th, 2007, 12:52 PM
// ActionScript 3 event handler
function clickButton(event:MouseEvent):void {
trace("b1 clicked");
}

// add event handler as listener of the
// click event received by b1 instance
b1.addEventListener(MouseEvent.CLICK, clickButton);

Summary of AS events ("Events Now" section starts into AS3 events)
http://www.senocular.com/flash/tutorials/as3withflashcs3/?page=3#events

Pattt
August 9th, 2007, 01:27 PM
Thanks, it worked well! :D
A quick question;

how do I make if(Key.isDown(Key.RIGHT)) or if(Key.isDown(34)) in AS3?

senocular
August 9th, 2007, 01:43 PM
http://www.kirupa.com/forum/showthread.php?p=2098269#post2098269