Announcement

Collapse
No announcement yet.

Responding to Key Presses

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Responding to Key Presses

    Responding to Key Presses

    Responding to Key Presses

    Document ID: IR10019
    The information in this article applies to:
    • AutoPlay Media Studio 5.0 Professional Edition

    SUMMARY

    This article describes how to make your application respond to key presses.

    DISCUSSION

    In AutoPlay Media Studio 5.0, there is an event called On Key. This event is launched whenever a key is pressed. This is useful if you want your application to, for example, play a sound every time the user presses a key.

    Another use for this event is to do something only when a specific key is pressed. As an example, consider Internet Explorer. A user types in a URL into the address bar, and when they press enter, the page they requested is loaded.

    To accomplish this example in AutoPlay Media Studio 5.0:

    Create an input object. In it's On Key event, input the following code:

    --e_Key is a built in variable. 13 is the ASCII value for [Enter]

    if e_Key == 13 then

    --Loads the text input by the user

    Web.LoadURL("Web1", Input.GetText("Input1"));

    end

    Please note that this script assumes that you have an input object named "Input1" and a web object named "Web1".

    This script reads every key pressed by the user while in the input box. When [enter] is pressed, the script loads the URL.

    MORE INFORMATION

    For more information please see the following topics in the AutoPlay Media Studio 5.0 help file:

    • Program Reference | Action Editor | Events | On Key

    KEYWORDS: AutoPlay Media Studio 5.0, Events, Key, Press


    Last reviewed: September 26, 2003
    Copyright © 2003 Indigo Rose Corporation. All rights reserved.
Working...
X