A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: using the letter keys?

  1. #1
    Junior Member
    Join Date
    Jan 2010
    Posts
    10

    [RESOLBED] using the letter keys?

    I am very new to these forums.

    I am just looking for a place to ask my questions. As I am very new to ActionScript 3. I just finished reading "Foundations of Game Design With Flash"

    and now I am starting my first major flash project. Which is a flash game I call Solar Racer. It is just a racing game, in space, with the racers being pushed by Solar Wind.

    But, I have run into a funny snag. Using event listners and such for the arrow keys is easy.

    so I import the proper stuff

    Code:
    	import flash.events.KeyboardEvent;
    	import flash.ui.Keyboard;
    the event listener

    Code:
    			stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyPressed);
    and the Event Handeler

    Code:
    		private function onKeyPressed(event:KeyboardEvent):void
    		{
    			trace(event.keyCode);
    		}
    Which works great most of the time. If I hit the arrow keys, the associated key codes get spit out.

    HOWEVER, if I hit the letter keys (in this case, I want to hit "p") Nothing happens!! It doesn't trace a number!

    I suspect this has to do with the shortcut keys in flash. As "P" is the key for the "Pen" tool.

    Does anyone know what exactly is going on, and how to get around it?

    Thanks!
    EvilTesla-RG
    Last edited by EvilTesla; 01-20-2010 at 09:17 PM. Reason: resolved

  2. #2
    ___________________
    Join Date
    May 2004
    Posts
    3,174
    you're exactly correct, the shortcut keys override the Test Movie environment. you can see full functionality when running in a browser (although obviously trace wouldn't have much effect).

  3. #3
    Junior Member
    Join Date
    Jan 2010
    Posts
    10
    AH!

    thank you

    That's going to make things a little more difficult.

  4. #4
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    There should be a way to disable shortcuts in the test player, though I don't know it off the top of my head. Search the forums.

  5. #5
    Junior Member
    Join Date
    Jan 2010
    Posts
    10

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center