Score Counter from Text fields.
Hello, need some help. My English is not good but I hope you understand me.
I have 3 text input fields: "taskai1", "taskai2", "taskai3" and 3 dynamic text fields: "suma1", "suma2", "suma3".
I want to do this thing.
Then I press F1 key the text writing marker stand on imput field "taskai1" and I want to write numbers with keyboard for example 150 and then I press enter I want to see on dynamic text field "suma1" 150 if i write again for example 100 I want to see the result of 250 and so on. But I have a problem.
Problem is then the movie plays to next scene or next frame the number from dynamic fields gone and I have to count again. I want that flash remember these numbers until I close the flash.
Maby someone can help?
That my simple code:
stop();
stage.displayState = StageDisplayState.FULL_SCREEN;
stage.addEventListener(KeyboardEvent.KEY_DOWN, EnterKeyDown);
function EnterKeyDown(event:KeyboardEvent):void{
if (event.keyCode == Keyboard.ENTER){
var komanda1:Number = Number(taskai1.text) + Number(suma1.text);
suma1.text = String(komanda1);
taskai1.text = '';
var komanda2:Number = Number(taskai2.text) + Number(suma2.text);
suma2.text = String(komanda2);
taskai2.text = '';
var komanda3:Number = Number(taskai3.text) + Number(suma3.text);
suma3.text = String(komanda3);
taskai3.text = '';
}
}
stage.addEventListener(KeyboardEvent.KEY_DOWN, F1KeyDown);
function F1KeyDown(event:KeyboardEvent):void{
if (event.keyCode == Keyboard.F1){
stage.focus = taskai1;
}
}
stage.addEventListener(KeyboardEvent.KEY_DOWN, F2KeyDown);
function F2KeyDown(event:KeyboardEvent):void{
if (event.keyCode == Keyboard.F2){
stage.focus = taskai2;
}
}
stage.addEventListener(KeyboardEvent.KEY_DOWN, F3KeyDown);
function F3KeyDown(event:KeyboardEvent):void{
if (event.keyCode == Keyboard.F3){
stage.focus = taskai3;
}
}
