Desmond
09-26-2003, 11:18 AM
<HTML> <HEAD> <TITLE>Remembering Runtime Preferences</TITLE> </HEAD> <BODY> <h3>Remembering Runtime Preferences</h3> <b>Document ID: IR10022</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 remember the user's runtime preference. </p> <h3>DISCUSSION</h3> <p>As an example, let us assume that your application asks the user if videos should be visible in the application. But you only want to ask the user the first time they launch the program. On each subsequent launch, you wish to show/hide the video object based on the user's initial preference.<br> <br> To accomplish this in AutoPlay Media Studio 5.0:</p> <p>Insert the following code into the On Preload event of the page containing the video object:<code><pre>visible = Application.LoadValue("Application", "Video");
<br />if visible == "" then
<br /> visible = Dialog.Message("Visible videos", "Do you want the Video Objects to be visible?", MB_YESNO);
<br /> Application.SaveValue("Application", "Video", visible);
<br />end
<br />
<br />if visible == 7 then
<br /> Video.SetVisible("Video1", false);
<br />end</pre></code> <p>This script does not give the user a second choice. Once they choose yes/no, that choice is permanent. If you wanted to offer the user a second choice, or the option to change the setting later, include the following code in the On Click event of a button object:<code><pre>visible = Dialog.Message("Visible videos", "Do you want the Video Objects to be visible?", MB_YESNO);
<br />Application.SaveValue("Application", "Video", visible);</pre></code></p> <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 | Actions | Application | Application.LoadValue</b></li> <li><b>Program Reference | Actions | Application | Application.SaveValue</b></li> </ul> <p> KEYWORDS: AutoPlay Media Studio 5.0, Actions, Preferences, Value, Load, Save, Runtime </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 visible == "" then
<br /> visible = Dialog.Message("Visible videos", "Do you want the Video Objects to be visible?", MB_YESNO);
<br /> Application.SaveValue("Application", "Video", visible);
<br />end
<br />
<br />if visible == 7 then
<br /> Video.SetVisible("Video1", false);
<br />end</pre></code> <p>This script does not give the user a second choice. Once they choose yes/no, that choice is permanent. If you wanted to offer the user a second choice, or the option to change the setting later, include the following code in the On Click event of a button object:<code><pre>visible = Dialog.Message("Visible videos", "Do you want the Video Objects to be visible?", MB_YESNO);
<br />Application.SaveValue("Application", "Video", visible);</pre></code></p> <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 | Actions | Application | Application.LoadValue</b></li> <li><b>Program Reference | Actions | Application | Application.SaveValue</b></li> </ul> <p> KEYWORDS: AutoPlay Media Studio 5.0, Actions, Preferences, Value, Load, Save, Runtime </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>