Hello All,
I’m new to AS3 and having a bit of trouble with listeners. The file consists of 3 buttons and 3 input fields. Clicking either of the first 2 buttons will place a specific number in one of the 2 corresponding input fields. The third button adds the previous 2 values and displays the result in the 3rd input field. The fields themselves are uneditable and only for displaying the numbers. My question is what is the correct listener/function to have the “total” function perform automatically when either of the first 2 text fields change in value…or if this is even possible…any help would be greatly appreciated…
The code below works as written…
b_total.addEventListener(MouseEvent.MOUSE_DOWN, total);
b01.addEventListener(MouseEvent.MOUSE_DOWN, button01);
b02.addEventListener(MouseEvent.MOUSE_DOWN, button02);
//
//
var input01:String;
var input02:String;
var plus:Number;
//
//
love01.text = “0”;
love02.text = “0”;
love_total.text = “0”;
//
//
function button01(event:MouseEvent):void{
love01.text = (“14”);
}
function button02(event:MouseEvent):void{
love02.text = (“8”);
}
function total(event:MouseEvent):void{
input01=love01.text;
input02=love02.text;
plus = parseInt(input01) + parseInt(input02);
plus.toString();
love_total.text = String(plus);
}