Key down, Key up, Key code problems

I've been having problems putting a key down handler
together, which is weird because it's pretty basic.
on keydown
if (_key.keycode = 4) then baOpenFile( the moviepath &
"help\help.pdf" , "maximised" )
end keydown
doesn't seem to do anything, key up the same. I know this is
a pretty basic thing, and in MX 2004 which is the Director version
I'm using, they've done it a little different but I can't seem to
see why it's not working.
help?!

Key functions operate in several different ways in Director.
If you have
an editable field or text member, then you can attach a
behavior to that
field or text sprite and include an on keyDown me and/or on
keyUp me
function. Because there is an editable sprite on the stage,
Director
will route key events to that sprite. If there is a function
to handle
the event, then something will happen. This sort of thing is
usually
done if you need to read and/or filter the user's input. You
don't need
a behavior at all if you just want the user to input
something.
If you are using key events for some other action, like
navigation or
game element control, then you need to tell Director to pay
attention to
the keyboard input. This is done by assigning a function as
the
keyDownScript or the keyUpScript. The assignment may be done
in a movie
event function, like startMovie, or it may be done in a
behavior.
Here's one example in a movie script window:
on startMovie
the keyDownScript = "readKeys"
end
on readKeys
case the keyCode of
4: baOpenFile(the moviePath &
"help\help.pdf","maximised")
end case
end
Here's an example in a behavior:
property thisSprite
on beginSprite me
thisSprite = me.spriteNum
the keyDownScript = "readKeys"
end
on endSprite me
the keyDownScript = ""
end
In the second example, the behavior could be attached to any
sprite that
will be available when you want the key events to be
interpreted.
Setting the keyDownScript to "" will stop Director from
paying attention
to key events.
Rob
Rob Dillon
Adobe Community Expert
http://www.ddg-designs.com
412-243-9119
http://www.macromedia.com/software/trial/

Similar Messages

  • Key code problem in samsung sgh-t719

    hi all,
    i have written a java program that is use to display the keycode value of the device keys. The application is working fine for most of the devices , but when running the application on samsung sgh-t719 the keys(qw ,as,op) are producing the value 0 and keys ( l , zx ) are not responding to keyPressed() function at all.
    can anybody put some light on it .

    have you search on samsung forums and samsung tech docs?
    it is weird that 3 keys produce the same key code...

  • Key code problem , Reply ASAP pls

    How should I compare 10 through keyCode

    keyListener = new Object();
    keyListener.onKeyUp = function() {
    trace(Key.getCode());
    var keyCode1 = Key.getCode();
    var keyCode2 = Key.getCode();
    if (keyCode1 == 97) {
    keyCode2 = Key.getCode();
    if (keyCode2 == 96) {
    gotoAndStop(10);
    } else {
    gotoAndStop(11);
    } else {
    gotoAndStop(11);
    Key.addListener(keyListener);
    But its jumping to frame 11;
    As per your suggestion I tried trace(key.getCode()), its also
    giving me 2 values 97 and 96 which are for 1 and 0 respectively.
    please help.

  • Key down events

    Hi,
    I've been working on code for handling a flash-plugin inside an existing application, and have been looking at getting the flash player working with the Cocoa/CoreGraphics API.
    Thus far, I have plugin loading, focus, mouse handling events all working. But then key events don't work consistently - on some flash applications, the key down events work, but on most they return a '1' but the flash app doesn't respond.
    This is most odd, and a pretty esoteric type of work - I don't know many people who get this kind of work, and it's hard finding people who can share their experiences of this.
    I've been going through the NPAPI docs on the mozilla website and copying a lot of the handling code in WebKit, Chromium and Firefox, but none of it seems to help any more - my handling code works the same way as that does, but the responses for key down events are different.
    So, this is just a last try before I go crazy - has anyone ever seen anything like this before?
    Thanks,
    Tom.

    Well, it is a problem with Flash Player and not Flash. I don't need an experienced Flash developer.
    Seriously though, the nature of the question is so esoteric that I doubt there are many developers anywhere who could give much advice.
    Thanks anyway.

  • I can't order more than one picture at a time in iphoto.  I am holding the command key down and highlighting two but only the last one is showing up

    Hi,
    I need help placing an iphoto order online for prints.  I have a few pictures I want in a few sizes and it seems to only allow me to select one at a time.  I have held the command key down but it defaults to the last picture i selected.  I appreciate your help.

    What system and iPhoto versions are you using?  As a quick test try this:  launch iPhoto with the Option key held down and create a new, test library.  Import some photos and check to see if the same problem persists.  See if you can get all of the selected photos in the order window as it should be.
    If you can't then try this:  make a temporary, backup copy (if you don't already have a backup copy) of the library and try the following:
    1 - delete the iPhoto preference file, com.apple.iPhoto.plist, that resides in your
         User/Home()/Library/ Preferences folder.
    2 - delete iPhoto's cache file, Cache.db, that is located in your
         User/Home()/Library/Caches/com.apple.iPhoto folder. 
    Click to view full size
    3 - launch iPhoto and try again.
    NOTE: If you're moved your library from its default location in your Home/Pictures folder you will have to point iPhoto to its new location when you next open iPhoto by holding down the Option key when launching iPhoto.  You'll also have to reset the iPhoto's various preferences.
    OT

  • Why can't I shut down my MacBook unless I hold down the power key?

    Hi all,
    I have had this problem my MacBook Pro using both Leopard and Jaguar. It is a problem when I shut down using either the drop down menu or by the power key menu. It appears to shut down but when I close the lid the "sleep" light comes on and is steady. It isn't actually shutting down because if I don't have the power charger plugged in it will run out of charge.
    So, to shut down, I hold the power key down for about 10 seconds.
    If it does fall asleep I am unable to awaken it (the sleep light is steady) and have to go through the holding down the power key procedure to shut it down and then use the power key to start it back up.
    Am I damaging it by doing this? I have tried the trouble shooting options as described in the manual. I had this problem before and one day it just wouldn't turn on and I had the hard drive replaced.
    Thank-you very much for any help!
    Becky Bell
    Sydney AUS
    Model Name: MacBook Pro 17"
    Model Identifier: MacBookPro1,2
    Processor Name: Intel Core Duo
    Processor Speed: 2.16 GHz
    Number Of Processors: 1
    Total Number Of Cores: 2
    L2 Cache: 2 MB
    Memory: 1 GB
    Bus Speed: 667 MHz
    Boot ROM Version: MBP12.0061.B03
    SMC Version: 1.5f10
    Serial Number: SystemSerialNumb
    Sudden Motion Sensor:
    State: Enabled

    I have found a solution on another thread that seems to have solved the problem for me. That is, I haven't experienced since, either the double password prompt at wake from sleep or the issue of not being able to shutdown.
    The solution requires deleting a preference file that apparently carried over from Tiger in the upgrade to Leopard and which is causing all the problems described. Preference files or .plist files hold configuration preferences and settings generally defined by the user for a particular operating system function. Deleting one of these files will result in the system recreating it on reboot with all settings set to default values, this is a simple way of fixing an incompatible/corrupt preference file.
    WARNING: Deleting preference files will reset all configurations for that files associated function. Custom user settings made in the +system preferences>Hardware>Energy Saver+ preference panel will have to be re-configured by the user.
    *_Step 1:_* Delete .plist files
    /Library/Preferences/SystemConfiguration/com.apple.PowerManagement.plist
    /Library/Preferences/SystemConfiguration/com.apple.AutoWake.plist (may not be necessary, holds schedule details for the Energy Saver preferences)
    *_Step 2:_* Reset Parameter RAM
    +Resetting PRAM and NVRAM+
    1. +Shut down the computer.+
    2. +Locate the following keys on the keyboard: Command, Option, P, and R. You will need to hold these keys down simultaneously in step 4.+
    3. +Turn on the computer.+
    4. +Press and hold the Command-Option-P-R keys. You must press this key combination before the gray screen appears.+
    5. +Hold the keys down until the computer restarts and you hear the startup sound for the second time.+
    6. +Release the keys.+

  • Webdynpro " How to add values in Drop down list By Key"

    Hi experts ,
    i want to create a drop down list by key, i don't know how to assign values to it ( i.e. add list entries ) . Please help me on this ..
    With regards ,
    James..
    Valuable answers will be rewarded ....

    Hi,
    To fix values to the drop down key at runtime in the webdynpro application you can use the following code:
    DATA:
    lr_node_flightinfo TYPE REF TO if_wd_context_node,
    lr_nodeinfo_flightinfo TYPE REF TO if_wd_context_node_info,
    l_scarr type scarr,
    lt_value_set TYPE TABLE OF wdr_context_attr_value,
    lw_value_set like line of lt_value_set.
    get nodeinfo of node flightinfo
    lr_node_flightinfo = wd_context->get_child_node( name = 'FLIGHTINFO' ).
    lr_nodeinfo_flightinfo = lr_node_flightinfo->get_node_info( ).
    get value set (VALUE = CARRID , TEXT = CARRNAME)
    select carrid carrname from scarr into table lt_value_set.
    clear lw_value_set.
    lw_value_set-value = 'AI'.
    lw_value_set-text = 'Air India'.
    append lw_value_set to lt_value_set.
    sort the value set by the describing TEXT
    SORT lt_value_set BY text.
    set value to context attribute
    lr_nodeinfo_flightinfo->set_attribute_value_set(
    name = 'CARRID' value_set = lt_value_set ).
    Here CARRID is a drop down by key field on the screen.
    in The context it is an attribute in the node FLIGHTINFO.
    Please give Reward Points if this piece of code helps
    Regards,
    Manish

  • I created a 2nd library for my husbands music and now I can't find my original library. I did hold down the shift key to open itunes but is still comes up with the new library. What am I doing wrong? I tried several times with no luck. Thank you.

    I just got an Ipod Classic recently and downloaded Itunes. Got my music on my Ipod. My husband just got an Ipod Touch. I followed the directions on how to create a 2nd library and was able to load his music onto his Ipod. My problem is now I can not find my original library. I did what the directions said about holding down the shift key while opening Itunes and it still goes to the 2nd library that I created. How do i get my original library to come up? I tried several times with the same results. Please let me know what I need to do to be able to get into either library. Thank You.

    Does the original library file still exist on the computer?  Hopefully when creating the new library it was done in a seperate folder as I do not believe iTunes allows for two library files in the same location.

  • My iPhone 4S has crashed 7 times. I hold down the home key and on button to reboot. I tried a restore but has crashed once since. Do I have a faulty phone ?

    My new iPhone 4S has crashed 7 times ie the screen does not come back on when I press the home key. I hold down the home key and on button to reboot and it always comes back. I tried a restore but it has crashed once since. Is this right  ? Do I have a faulty phone ? Any suggestions ?

    Does the screen come back on if you press the sleep/power button?
    Have you tried powering down (hold sleep/power button and swipe red slider) then power back up?  Power cycling sometimes will clear problems.
    If neither works, and you can get to an Apple store, have the genius bar folks try it out...they are very good about replacement if faulty.

  • Key down event to start something an stop arbirtrary

    hallo,
    what I'm trying to do is to start an event on key down an do a loop , something like move an axis for CNC , and this until i press an arbitrary key again.
    i have already a while loop an an event structure so it would be good just to add something withtout large modifications.
    have anyone an example code for me , please.
    i've looked already in a lots of posts but i can't find anything usefull for me.
    many thanks in advance

    again - lots of ways to do this.
    The attached example is just the fastest I could modify the previous version
    2006 Ultimate LabVIEW G-eek.
    Attachments:
    keydownvi3.vi ‏53 KB

  • Key down event handeling when the VI isn't active

    Hi
      I've written a simplel VI that increases or decreases a numerical indicator depending on which key is pressed on the keyboard. But this only works when the VI window is active (the titlebar is blue and not gray). Is there anyway to listen for the key-down event even though the VI is not active?
    In advance thanks
    Georg

    I recently ran into a problem with the Acquire Data.
    See http://forums.ni.com/ni/board/message?board.id=170&message.id=147363
    Just in case....

  • Key down event in background

    Is there a way to make the key down event in the wait event structure run in the background when labview is not the focus? Also what is the difference between the "key down? event" and the "key down event"? I couldn't find a good answer in the LabVIEW help.

    tst wrote:
    To expand a bit on RF's answer, while you can't use the event structure to register for key down events in other windows, there are some potential options:
    You could use the input VIs to poll the keyboard (and you can have a loop which will use a user event to send each new key to an event structure). The main problem with this (and it's a big one) is that it is unreliable. You would have to poll quickly enough (probably at ~20-50 Hz) to have a decent chance of being sure that you're not missing keys and even then it's not guaranteed. The other problem is that you don't know which window was actually in focus.
    You could try getting the window messages from the other window. I have no real experience with Windows messaging, but my understanding is that this will probably require you to write a custom hook in C to get it, but it's possible that this is also possible with the standard Win32 API functions. Even if it is, this is probably not something you want to get into to, but you could try looking it up.
    Actually this Windows Messaging already exists in LabVIEW:
    http://zone.ni.com/devzone/cda/epd/p/id/4394
    However there is a few issues.  It only partially works in Windows 64-bit, and you have to know the handle to the application that you want to intercept key downs for.  I did a quick test and I was able to detect the KEYDOWN event in another VI that was running for for some reason got an error when I tried to get keydown on notepad.  This method would eliminate polling if you can get it to work, and because of this you shouldn't miss any key presses.
    Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
    If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.

  • How do I clear the control alt delete key downs when using input acquire.vi?

    I am trying to monitor keystroks...  When I use the Input Acquire.vi after I log in to my system it says the Control LAlt and the Delete key are down and my code does not like that because the keyboard value is not corect...the Keypressed array always has 3 keys down....
    Is there a way to clear them or send key ups some how to get rid of them.
    Thanks for any help you can provide...
    I am using Labview 8.0
    Thanks
    Eric Horwitz

    There is no way that you can press multiple buttons at exactly the same time. Which keys are you trying to press? Are you talking about "PlatMods" (shift, ctrl, etc.)?
    Keep a shift registers with the states of the desired buttons in a boolean array and change the respective elements to true or false, depending on key-up and key-down events. On the Key down events, check if all elements are true and act accordingly.
    LabVIEW Champion . Do more with less code and in less time .

  • Key Down Trigger

    Plz assist me.
    I have a form with a textitem Name and I do not want the user to enter any key apart from [A-Z] i.e ascii value (65 to 90). I want to create a trigger on key-down which returns simple message "plz enter characters only" if user enters any key apart from [A-Z].
    Plz answer Thank you.

    Create or Replace function funasc (RC Varchar2) Return Boolean
    is
    vali Number := 0;
    kv Number := 0;
    vk Number := 0;
    as Number := 0;
    ab Number := 0;
    len Number := 0;
    Begin
    len := length(RC);
    For I in 1..len Loop
    If I <> 4 then
    vali := ascii(substr(RC, I, 1);
    If Vali Between 65 and 90 then
    kv := kv + 1;
    Else
    ab := ab + 1;
    End if;
    Elsif I = 4 then
    vali := ascii(substr(RC, I, 1);
    If vali = 45 then
    vk := 1;
    Else
    ab := 1;
    End if;
    End If;
    End Loop;
    as := KV + vk;
    If as <> len then
    Return True;
    Elsif as = len then
    Return False;
    End if;
    End;
    Trigger : When-Validate-Item
    Text_Item : Route_Code
    Declare
    RC Fare.Route_Code%Type;
    Alt Number;
    Begin
    If funasc(:fare.route_code) then
    message ('Route Code : ' || :fare.route_code || ' is invalid.!');
    Set_Alert_Property ('ALERTRC', title, 'ROUTE CODE VIOLATION');
    Set_Alert_Property ('ALERTRC', alert_message_text, 'Route Code : ' || :fare.route_code || ' is invalid. Plz enter Route Code in [ABC-XYZ] format.!');
    Alt := Show_Alert ('ALERTRC');
    Raise Form_Trigger_failure;
    Else
    Select route_code into :fare.route_code from Fare where route_code = :fare.route_code;
    message ('Route Code : ' || :fare.route_code || ' already exists.!');
    Set_Alert_Property ('ALERTRC', title, 'ROUTE CODE VIOLATION');
         Set_Alert_Property ('ALERTRC', alert_message_text, 'Route Code : ' || :fare.route_code || ' already exists.!');
    Alt := Show_Alert ('ALERTRC');
    Raise Form_Trigger_failure;
    Else
    Null;
    End if;
    End if;
    Exception
    When No_Data_found Then
         Null;
    End;
    Wht this coding does is if route_code is not ABC-XYZ format then it through an alert, also if user enters number instead of char then it popup an alert.
    Now can this coding be made even smaller.

  • Key down in event structure

    Hello
    I am using arrows on my keyboard to controll program (UP DOWN LEFT RIGHT)
    By using key down in event structure i know what button is pressed
    But I need  to detect that 2 buttons are pressed in the same time to make diffrent cases for that. I dont know haw to handle that.
    Any suggestions appreciated
    Solved!
    Go to Solution.

    Here's what I had in mind. Modify as needed.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    CursorKeys.vi ‏17 KB
    cursorkeys.png ‏23 KB

Maybe you are looking for

  • Problems with mail after upgrading to Mavericks

    Hello, since I upgraded to Mavericks, I have problems with Mail. The mail app doesn't retrieve any mail from my email servers. IMAP or POP or exchange mail no longer work. I have these problems on my iMac and my MBP. The strangest thing is that I hav

  • How do I create envelopes in Pages using Numbers as the source?

    I've done this successfully before back in 2011 when I was sending out Holiday Cards.  Now I go in there today looking to use the same envelope template and an updated (not everybody lives in the same location) Numbers spreadsheet and I keep getting.

  • I have an empty box on my bookmarks toolbar I can't get rid of.

    Starting today, I have an empty box on my bookmarks toolbar that I can't get to go away. It comes after the >> icon where I can see more bookmarks, but it is linked to the bookmarks toolbar as it goes away when I uncheck this bar. I have tried custom

  • How to list policies ?

    Anyone knows how Access Manager policies are stored in Directory Server and if there is a way to list the policies using LDAP access (like the "ldapsearch" tool) ? Thanks, Valter

  • How to organize songs in playlist?

    I have an iPhone 4s, and on my Favorite playlist I had them organized by alphabetical order to keep track of which songs i had in the playlist and which ones i didn't. When i went to look to see if i had a certain song on the playlist, i realized the