Hi once again
I have one of my usual switch statements that perhaps shows my age:-)
The code snippet shows 2 key presses that set oldText to a String.
What I am looking for is to detect the text change from “Forward” to “Left”
and to reset _counter to 0 on change value of oldText.
As usual, all help is so very much appreciated
<code>
private var oldText:String;
private var _counter:int=0;
public function onKeyDown(e:KeyboardEvent):void{
switch(e.keyCode)
{
case 38:_moveForward
//If oldtext has changed reset _counter= true;
oldText = “Forward”;
_counter++;
break;
case 37: _moveLeft = true;
//If oldtext has changed reset _counter to 0
oldText = “Left”;
_counter++;
break;
}
public function changeEnterFrame (e:Event)
{ if (oldText != textField.text)
{ _counter = 0}
stage.addEventListener(Event.ENTER_FRAME, changeEnterFrame);
</code>