PDA

View Full Version : onKeyDown increments currentframe at root of script


Ritalin
06-05-2006, 02:22 PM
I'm having a bit of a problem. I've made something that increments the _root._currentframe, but it keeps adding 1 to the _currentframe when the playhead hits the frame that the script is on. I'm not sure why, but maybe someone can enlighten me. Just open a new fla and add a bunch of empty frames, then paste this script in one of them. Any suggestions?


stop();

_root.createTextField("textBox",_root.getNextHighestDepth(),6,60,134,20);

_root.onEnterFrame = function () {
textBox.text = _root._currentframe;
}


var keyListener_obj:Object = new Object();
keyListener_obj.onKeyUp = function(){
switch(Key.getCode()){
case Key.SPACE:
trace(Key.getCode);
//_root.gotoAndStop(+1);
_root._currentframe++;
break;
case Key.LEFT:
if(_root._currentframe<=2){
_root._currentframe=2;
}

//_root._currentframe--;
_root.prevFrame();
break;
case Key.RIGHT:
//_root._currentframe++;
_root.nextFrame();
break;
}
};
Key.addListener(keyListener_obj);

Ritalin
06-10-2006, 04:20 AM
is there no one who knows a work-around or has an answer?