# Number Pad 101

**URL:** <https://forum.kirupa.com/t/number-pad-101/65961>\
**Category:** flash\
**Created:** [September 30, 2004, 11:09pm UTC](https://forum.kirupa.com/t/number-pad-101/65961 "2004-09-30T23:09:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![BlackFire](https://avatars.discourse-cdn.com/v4/letter/b/a5b964/32.png) [@BlackFire](https://forum.kirupa.com/u/BlackFire)\
**Post date:** [September 30, 2004, 11:09pm UTC](https://forum.kirupa.com/t/number-pad-101/65961/1 "2004-09-30T23:09:11Z")

</div>

[http://www.actionscript.org/forums/showthread.php3?t=55679](http://www.actionscript.org/forums/showthread.php3?t=55679)

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 1, 2004, 8:19pm UTC](https://forum.kirupa.com/t/number-pad-101/65961/2 "2004-10-01T20:19:26Z")

</div>

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

```auto
  
[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:

```auto
 
[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.

```auto
 
[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
