Just for the benifit of the community, I got this fixed using senocular's KeyObject.as file
On Jul 16, 5:39 pm, maltech <[email protected]> wrote: > Ya im on flashkit boards too, just seems to be more knowledgable > people here lol. > > It did work to an extent. It allows smooth transition from going to > one direction or another, but it still will not accept 2 keys at the > same time to roll/yaw together for example. > > I am sure that I could do something like (lastKey===87&Keyboard.LEFT) > however I need something more universal, as this is going to cause > problems when I add weapon firing etc, movement is going to stop if > they hit the weapon fire button. > > On Jul 16, 5:27 pm, Peter Kapelyan <[email protected]> wrote: > > > If that doesn't work I'll try to dig up some code that I use on my > > games...also this is something you might find on flash game coding sites. > > > -Pete > > > On Thu, Jul 16, 2009 at 5:22 PM, Peter Kapelyan <[email protected]> wrote: > > > dont use switch/case try something like: > > > > if(lastkey==87){ > > > etcetc > > > } > > > if(lastkey==83){ > > > etcetc > > > } > > > > Should work > > > > -Pete > > > > On Thu, Jul 16, 2009 at 5:01 PM, maltech <[email protected]> wrote: > > > >> I have my controls doing what they need to do, however if you press > > >> more than one key it stops moving. I was wondering if anyone has a way > > >> to make this work better. > > > >> Here is a code snippy > > > >> this.stage.addEventListener(KeyboardEvent.KEY_DOWN,keyDown); > > > >> this.stage.addEventListener(KeyboardEvent.KEY_UP,keyUp); > > > >> this.addEventListener(Event.ENTER_FRAME,onEnterFrame); > > > >> } > > >> private function onEnterFrame(e:Event):void > > >> { > > >> if(keyIsDown){ > > >> // if the key is still pressed, > > >> just keep on moving > > >> switch(lastKey){ > > >> case 87 > > >> : fighter.moveForward(10); break; > > >> case 83 > > >> : fighter.moveBackward(5); break; > > >> case 65 > > >> : fighter.roll(2); break; > > >> case 68 > > >> : fighter.roll(-2); break; > > >> case Keyboard.UP : > > >> fighter.pitch(2); break; > > >> case Keyboard.DOWN : > > >> fighter.pitch(-2); break; > > >> case Keyboard.RIGHT : > > >> fighter.yaw(2); break; > > >> case Keyboard.LEFT : > > >> fighter.yaw(-2); break; > > >> } > > >> } > > >> ltarget.transform = fighter.transform; > > >> ltarget.moveForward(1000); > > >> ltarget.moveDown(100); > > >> view.camera.transform = fighter.transform; > > >> view.camera.pitch(10); > > >> view.camera.moveForward(28); > > >> view.camera.moveUp(5); > > >> view.render(); > > >> } > > >> private function keyDown(e:KeyboardEvent):void > > >> { > > >> lastKey = e.keyCode; > > >> keyIsDown = true; > > >> } > > >> private function keyUp(e:KeyboardEvent):void > > >> { > > >> keyIsDown = false; > > >> } > > >> } > > >> } > > > > -- > > > ___________________ > > > > Actionscript 3.0 Flash 3D Graphics Engine > > > > HTTP://AWAY3D.COM > > > -- > > ___________________ > > > Actionscript 3.0 Flash 3D Graphics Engine > > > HTTP://AWAY3D.COM
