i’m trying to make it so as someone clicks on to the button after entering their information, the results will follow up as hi “persons name” you have (their total amount)
here is my code:
{//2
private var yourName:TextField;
private var results:TextField;
private var hrsWorked:TextField;
private var wages:TextField;
private var numWages:int =
public function_Calculator()
{//3
//adding my graphic
var base:CalculatorBase = new CalculatorBase();//adding the object
this.addChild(base);//displaying the object
base.x = 380;//position left or right
base.y = 280;//position up or down
//adding my second graphic
var button:CalButton = new CalButton(); //adding the object
this.addChild(button);//displaying the object
button.x = 460; //position left or right
button.y = 410; // position up or down
//changing the font format
var format:TextFormat = new TextFormat();//adding the object
format.font = "Arial";//font format
format.size = 20;//font sizing
format.align = "left";//font align
//name
yourName = new TextField();//adding the object
this.addChild(yourName);//displaying the object
yourName.border = true;//setting the border
yourName.borderColor = 0xFFFFFF;//setting border color
yourName.x = 280;//position left or right
yourName.y = 220;//position up or down
yourName.width = 198;// changing width
yourName.height = 25;// changing height
yourName.type = TextFieldType.INPUT;//making sure the text area is for input
yourName.defaultTextFormat = format;//sets text format to defult
yourName.maxChars = 32;//text limit of characters
yourName.restrict = "a-zA-Z'. ";//keeping certain fonts from being used
//hours
hrsWorked = new TextField();//adding the object
this.addChild(hrsWorked);//displaying the object
hrsWorked.border = true;//setting the border
hrsWorked.borderColor = 0xFFFFFF;//setting border color
hrsWorked.x = 328;//position left or right
hrsWorked.y = 283;//position up or down
hrsWorked.width = 98;// changing width
hrsWorked.height = 25;// changing height
hrsWorked.type = TextFieldType.INPUT;//making sure the text area is for input
hrsWorked.defaultTextFormat = format;//sets text format to defult
hrsWorked.maxChars = 5;//text limit of characters
hrsWorked.restrict = "0-9.";//keeping certain fonts from being used
//wages
wages = new TextField();//adding the object
this.addChild(wages);//displaying the object
wages.border = true;//setting the border
wages.borderColor = 0xFFFFFF;//setting border color
wages.x = 330;//position left or right
wages.y = 350;//position up or down
wages.width = 98;// changing width
wages.height = 25;// changing height
wages.type = TextFieldType.INPUT;//making sure the text area is for input
wages.defaultTextFormat = format;//sets text format to defult
wages.maxChars = 6;//text limit of characters
wages.restrict = "0-9.$";//keeping certain fonts from being used
//result text field
results = new TextField();//adding the object
this.addChild(results);//displaying the object
results.border = true;//setting the border
results.borderColor = 0xFFFFFF;//setting border color
results.textColor = 0xFFFFFF;//setting the font color
results.x = 250;//position left or right
results.y = 445;//position up or down
results.width = 258;// changing width
results.height = 33;// changing height
button.mouseChildren = false
button.addEventListener(MouseEvent.CLICK, onClick);
}//3
//
private function onClick(event:MouseEvent):void
{
this.results.text = "Hi, " +(yourName) +(hrsWorked + wages);
}
}//2
}//1