A Flash Developer Resource Site

Results 1 to 13 of 13

Thread: another AS1 -AS2 quirk!!

  1. #1
    Special Member Tea_J's Avatar
    Join Date
    Dec 2000
    Posts
    991

    another AS1 -AS2 quirk!!

    Why won't this work with AS2???

    attached code to button..
    settings as2, flashplayer 7.

    Code:
    on (release,keyPress("<enter>"){
    trace("foo");
    }

    It seems to work fine on AS1.. what's wrong with it on AS2?

  2. #2
    wow, no idea why that doesn't work, but it does respond to Shift+Enter.


  3. #3
    Special Member Tea_J's Avatar
    Join Date
    Dec 2000
    Posts
    991
    what? howcome? what's wit shift+enter? lemem try that..

    ANYONE GOT AN ANSWER TO THIS?


    Tea

  4. #4
    FK's Giant Steve_w_V's Avatar
    Join Date
    Mar 2003
    Location
    San Jose, California
    Posts
    2,113
    Perhaps
    code:
    on(release, keyPress"<Enter>"){
    //code
    }


    Maybe its case sensitive.
    The other day, I bought a box of animal crackers. On the side, it said "Do Not Eat if Seal is Broken". I opened the box and sure enough...

  5. #5
    Originally posted by Steve_w_V

    Maybe its case sensitive.
    nope, makes no difference.

    @Tea_J: What I meant was, your code does not respond when hitting the enter key, but it does respond when you hit the shift key and the enter key at the same time, which is odd

  6. #6
    Special Member Tea_J's Avatar
    Join Date
    Dec 2000
    Posts
    991
    @yasunobu13

    yeah, i knew that. it was like "what?!!!" in shock.. hehe.. it was surprising to me to see certain key combination work.. which is REALLY REALLY ODD.

    People?! Got any idea's why this is? Or did the good people in macromedia forget to add these functions to AS2?

    Tea

  7. #7
    Special Member Tea_J's Avatar
    Join Date
    Dec 2000
    Posts
    991
    c'mon guys.. im sure someone here has experienced this also..
    tea

  8. #8
    Member
    Join Date
    Aug 2003
    Posts
    30
    code:

    on (release,keyPress("<enter>"){
    trace("foo");
    }



    I didn't try this, but you're missing an end parenthesis:

    code:

    on (release,keyPress("<enter>")){
    trace("foo");
    }



    Try that?

  9. #9
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001
    Location
    uk
    Posts
    11,222
    Hi,

    code:

    on (release, keyPress "<Enter>" ) {
    // code
    }



    does work, either test your movie in a browser, or if you use test movie make sure you disable keyboard shortcuts (control > disable keyboard shortcuts) since in test movie the enter key is normally the shortcut for control > play. (this is the same behaviour as was found in MX)

  10. #10
    Special Member Tea_J's Avatar
    Join Date
    Dec 2000
    Posts
    991
    aite cool. it's working. but, if you guys dont mind me adding to this, how do we go about giving the same functionality to an MC, since Movie Clips have inherited button properties in Flash MX...

    This was one reason why I got confused with the keypress issue. COz im using the button component and adding the keyPRess trigger.. Ofcourse, stoopid old me assumed that it should work like a button.

    Tea

  11. #11
    Special Member Tea_J's Avatar
    Join Date
    Dec 2000
    Posts
    991
    ignore my previous post. I just figured out something. it might be a bug.

    Try this guys..

    1) First create a regular button symbol, and add a keypress "a" trigger to it that would do a trace action.. (dont use <enter> to avoid additional complications)

    2) make sure it's working.. hit your keys and see if it's working..

    3) now, this is the interesting part! Grab a button component from the components panel and put it on in yor movie.. u dont have to do anything.

    4) now test your previous button again.

    you will see that when you use a button component in your movie, you loose keyPress functionalities in your regular buttons!!! Even if you remove the Button Component from your stage, as long as it's in the library, you can say goodbye to good old KeyPress functions..


    Please give me some feedback you guys.

    Tea

  12. #12
    Senior Member
    Join Date
    May 2001
    Posts
    1,838
    Even in Flash MX, if you put two regular buttons and write each on(keyPress "a"){...};, only one is effective and the other is bye-bye ?

  13. #13
    Special Member Tea_J's Avatar
    Join Date
    Dec 2000
    Posts
    991
    @ericlin

    im sorry mate, but you got it wrong. Please read it again.
    "BUTTON COMPONENTS ARE MESSING THINGS UP "

    Try even just adding a button component to your library.. not even to your stage. YOu'll see that your keypress's are not working anymore

    guys, ya'll should check this issue out.

    Tea

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