Desmond
09-26-2003, 10:49 AM
<HTML> <HEAD> <TITLE>Responding to Key Presses</TITLE> </HEAD> <BODY> <h3>Responding to Key Presses</h3> <b>Document ID: IR10019</b> <hr> The information in this article applies to: <ul> <li>AutoPlay Media Studio 5.0 Professional Edition</li> </ul> <hr> <h3>SUMMARY</h3> <p>This article describes how to make your application respond to key presses. </p> <h3>DISCUSSION</h3> <p>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.<br> <br> 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.<br> <br> To accomplish this example in AutoPlay Media Studio 5.0:<br> <br> Create an input object. In it's On Key event, input the following code:<code><pre>--e_Key is a built in variable. 13 is the ASCII value for [Enter]
<br />if e_Key == 13 then
<br /> --Loads the text input by the user
<br /> Web.LoadURL("Web1", Input.GetText("Input1"));
<br />end</pre></code> <br> Please note that this script assumes that you have an input object named "Input1" and a web object named "Web1".<br> <br> This script reads every key pressed by the user while in the input box. When [enter] is pressed, the script loads the URL. <h3>MORE INFORMATION</h3> <p>For more information please see the following topics in the AutoPlay Media Studio 5.0 help file:</p> <ul> <li><b>Program Reference | Action Editor | Events | On Key</b></li> </ul> <p> KEYWORDS: AutoPlay Media Studio 5.0, Events, Key, Press </p> <hr> <FONT SIZE=1> Last reviewed: September 26, 2003<br> Copyright © 2003 <A HREF="http://www.indigorose.com" target="blank">Indigo Rose Corporation</a>. All rights reserved.<br> </FONT> </BODY> </HTML>
<br />if e_Key == 13 then
<br /> --Loads the text input by the user
<br /> Web.LoadURL("Web1", Input.GetText("Input1"));
<br />end</pre></code> <br> Please note that this script assumes that you have an input object named "Input1" and a web object named "Web1".<br> <br> This script reads every key pressed by the user while in the input box. When [enter] is pressed, the script loads the URL. <h3>MORE INFORMATION</h3> <p>For more information please see the following topics in the AutoPlay Media Studio 5.0 help file:</p> <ul> <li><b>Program Reference | Action Editor | Events | On Key</b></li> </ul> <p> KEYWORDS: AutoPlay Media Studio 5.0, Events, Key, Press </p> <hr> <FONT SIZE=1> Last reviewed: September 26, 2003<br> Copyright © 2003 <A HREF="http://www.indigorose.com" target="blank">Indigo Rose Corporation</a>. All rights reserved.<br> </FONT> </BODY> </HTML>