Flash Buttons! (inc, new AS3 version).
Here are a few different ways of implementing a button within flash using as code/button. basically all you need to do is drop or create a button on your main timeline. Then see the code sniplet examples below:
//as code
//as code
//AS1 version, click onto the button then add code onto it.
on(release){
trace("as1Btn - clicked");
}
//This will work with AS1, but will need to add an instance name to the button.
as1Btn.onRelease = function(){
trace("as2Btn - clicked");
}
//AS2 version, add your button to the stage then give your button an instance
name 'as2Btn' then add this sniplet anywhere on your main timeline.
as2Btn.onRelease = function():Void {
trace("as2Btn - clicked");
}
//AS3 version, same as above basically.
as3Btn.addEventListener(MouseEvent.MOUSE_DOWN,pressBtn);
function pressBtn(event:MouseEvent){
trace("as3Btn - clicked");
}
Labels: action script, as1, as2, as3, buttons, Encrypt Flash