A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: KeyPress

  1. #1
    Registered N00b
    Join Date
    Jan 2005
    Location
    i'm a noob
    Posts
    208

    KeyPress

    What is wrong with this keyPress command?
    Code:
    def.onEnterFrame = function(){
    	x4 = this._x
    	y4 = this._y
    	y5 = y4
    	x5 = x4
    	x5 += 46
    	y5 += 40
    	y4 -= 40
    	if ((((guy._x > x4) && (((guy._y > y4)) && ((guy._x < x5))) && (guy._y < y5)))) {
    		if (keyPress "1") {
    			def.play();
    		}
    	}
    };
    dont mind the part in bold its a substitute for a hitTest command.
    ^ noob

  2. #2
    Actionscript Developer KigD's Avatar
    Join Date
    Jan 2003
    Location
    georgia
    Posts
    597
    Wrong syntax.

    Try this:

    if (Key.isDown(<KEYCODE FOR 1 (you might have to look it up)> ))
    {
    def.play();
    }

    Btw, you might want to do onClipEvent(keyDown) instead of enterFrame.

    -Danny
    K2xL - My games, tutorials, message boards, and experiments.
    Blog

  3. #3
    Registered N00b
    Join Date
    Jan 2005
    Location
    i'm a noob
    Posts
    208
    i figured it out by putting it in a button kthxbi
    ^ noob

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