____  _ ____ ____ ______ ____  
|___ \| |___ \___ \____  |___ \ 
  __) | | __) |__) |  / /  __) |
 |__ <| ||__ <|__ <  / /  |__ < 
 ___) | |___) |__) |/ /   ___) |
|____/|_|____/____//_/   |____/ 
      

i pwn all thats all u need to know.

Thursday, November 22, 2007

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

//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: , , , , ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home