Number Pad 101

http://www.actionscript.org/forums/showthread.php3?t=55679

Sorry kirupa, i just couldn’t fit the attachment into your forums. :wink:

I used this code to give values to the buttons which have instance names of nr1, nr2, nr3,…nr0, enter.

  
[left]Selection.setFocus("pass");
for (i=0; i<=9; i++) {
	this["nr"+i].i = i;
	this["nr"+i].onPress = function() {
		pass.text += this.i;
	};
}[/left]

And this is the code I used for each button:

 
[left]on (release) {

	//Movieclip GotoAndPlay Behavior
	this.n1.gotoAndPlay("flash");
	//End Behavior

}

onClipEvent (keyDown) {
	pressed = Key.getCode();
	if (pressed >=48 or pressed >=96) {
	//Movieclip GotoAndPlay Behavior
	this.n1.gotoAndPlay("flash");
	//End Behavior
	}
}[/left]

the gotoAndPlay of “flash” is the small animation that makes them flash colors.

also here is the code i used for the enter that, when i press enter, will not work at all.

 
[left]on (release) {

	//Movieclip GotoAndPlay Behavior
	this.nEnter.gotoAndPlay("flashe");
	//End Behavior

}

onClipEvent (keyDown) {
	pressed = Key.getCode();
	if (pressed == "<Enter>") {
	//Movieclip GotoAndPlay Behavior
	this.nEnter.gotoAndPlay("flashe");
	//End Behavior
	}
}[/left]

-Blackfire