dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: How to do onkeypress

  1. #1
    Member
    Join Date
    Nov 2005
    Posts
    86

    How to do onkeypress

    I have a question here...

    I have a MC and i want it to jump to a certain frame label once i do a onKeyPress function but I dont get the code...

    it's gonna look something like:

    Code:
    myMC.onKeyPress ('keypress') = function(){
    this.gotoAndPlay('label');
    };
    But what's gonna be the stuff after the myMC.?

    How would I tell flash that onKeyPress I want the keypress to be left or right, or up, or down? Please help...

    ALex
    TurquoiseGala.org
    x-Sellus Shopping
    NYOC.net

  2. #2
    I think what you want to do is...


    Code:
    onClipEvent(enterFrame) {
         if(Key.isDown(Key.DOWN)) {
              gotoAndStop("label");
         }
    }
    If you put that on the movieclip, it should work.

    Peace,
    ~Bill
    So many Ideas

    So little Time

  3. #3
    Senior Member FohpreF1's Avatar
    Join Date
    Apr 2006
    Location
    Australia
    Posts
    100
    I made a fighting game not to long ago and I'm pretty sure that if you put a invisible button inside "MyMC" you dont need to have the onClioEvent script you just plain out say:

    if (Key.isDown(Key.DOWN) {
    gotoAndPlay("punch");
    }

    But maybe I have no idea what i am talking about.

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