--------------------------------------------------------------------------------------------
AS2 CODE:
--------------------------------------------------------------------------------------------
//AS2 CODE
//MAKE TEXT BOX WITH INSTANCE NAME "Txt1"
//MAKE 0 TO 9 BUTTON WITH INSTANCE NAME "Bn0" TO "Bn9"
//MAKE ENTER AND CLEAR BUTTON INSTANCE NAME "BnEnter" TO "BnClear"
//MAKE BLANK KEY FRAME 2
stop();
Bn0.onPress=function(){
Txt1.text += "0"
}
Bn1.onPress=function(){
Txt1.text += "1"
}
Bn2.onPress=function(){
Txt1.text += "2"
}
Bn3.onPress=function(){
Txt1.text += "3"
}
Bn4.onPress=function(){
Txt1.text += "4"
}
Bn5.onPress=function(){
Txt1.text += "5"
}
Bn6.onPress=function(){
Txt1.text += "6"
}
Bn7.onPress=function(){
Txt1.text += "7"
}
Bn8.onPress=function(){
Txt1.text += "8"
}
Bn9.onPress=function(){
Txt1.text += "9"
}
BnEnter.onPress=function(){
if (Txt1.text == "123") {
nextFrame ();
}
else {
Txt1.text = "";
}
}
BnClear.onPress=function(){
Txt1.text = "";
}
--------------------------------------------------------------------------------------------
OR USE THIS AS2 WITHOUT STRING CODE:
--------------------------------------------------------------------------------------------
stop();
Bn0.onPress=function(){
Txt1.text += 0
}
Bn1.onPress=function(){
Txt1.text += 1
}
Bn2.onPress=function(){
Txt1.text += 2
}
Bn3.onPress=function(){
Txt1.text += 3
}
Bn4.onPress=function(){
Txt1.text += 4
}
Bn5.onPress=function(){
Txt1.text += 5
}
Bn6.onPress=function(){
Txt1.text += 6
}
Bn7.onPress=function(){
Txt1.text += 7
}
Bn8.onPress=function(){
Txt1.text += 8
}
Bn9.onPress=function(){
Txt1.text += 9
}
BnEnter.onPress=function(){
if (Txt1.text == 123) {
nextFrame ();
}
else {
Txt1.text = "";
}
}
BnClear.onPress=function(){
Txt1.text = "";
}
--------------------------------------------------------------------------------------------
OR USE THIS AS2 WITH VARIABLE:
--------------------------------------------------------------------------------------------
Btn1.onPress=function(){
var Num1:Number = 1;
Txt1.text += Num1;
}
AS3 CODES:
NEED TO REPLACE BUTTON FUNCTIONS IN AS3
--------------------------------------------------------------------------------------------
BN1.addEventListener(MouseEvent.CLICK,FN1);
function FN1(event:MouseEvent):void{
Txt1.text += "1"
}
//OR USE THIS CODE
BN1.addEventListener(MouseEvent.CLICK,FN1);
function FN1(event:MouseEvent):void{
Txt1.text += 1
}
//OR USE THIS CODE WITH APPEND TEXT
var Num1:Number = 1;
BN1.addEventListener(MouseEvent.CLICK,FN1);
function FN1(event:MouseEvent):void{
Txt1.appendText([Num1]+"")
}
//OR USE THIS CODE WITH APPEND TEXT WITH STRING
var Num1:String = "1";
BN1.addEventListener(MouseEvent.CLICK,FN1);
function FN1(event:MouseEvent):void{
Txt1.appendText([Num1]+"")
}
EmoticonEmoticon