A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: where 2 put flash5 event (keypress) handler?? argh

  1. #1
    Junior Member
    Join Date
    Sep 2000
    Posts
    14

    Thumbs up

    hi,
    i'm not a weenie @ all and i've written the hardest code, but this is really killin me: where do i have to put the event-handler code for the keypress event in flash5?

    the actionscript-dictionary is no help (i wonder how they match what they write and what they did) and i've found all the phorum tipps to be not working with flash5 either.

    i've created extra movies, extra buttons, tried to put the code everywhere the IDE let me ... nothing but errors. a basic form of the code i tried to paste looks like:

    onClipEvent(keyDown) {
    if (Key.getCode() == 32) {
    do_my_func ()
    }
    }

    but believe me, i tried many many many variation.

    (code like
    On (Key: a)
    Set Variable: "keypresses" = keypresses & "a"
    End On
    did not work at all as well - no matter where i put it)

    is there anyone who can help me?? pleeeaze?

    alfons

  2. #2
    Junior Member
    Join Date
    Sep 2000
    Posts
    14

    ahhhhh - now i know

    puh, i needed 2 days to think about it ... what a pain. well, well, it's not java ;-) but i like it! :-)

    the answer was to paste all the events into one event handler statement:

    on (release, keypress "3") {
    add_digit ("3");
    }

    (and forget about the Key object and other lightweighted-OOP stuff)

    groovy, isn't it?

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