How do I...?

Remember Runtime Preferences

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.

To accomplish this in AutoPlay Media Studio:

  1. Insert the following code into the On Preload event of the page containing the video object:

visible = Application.LoadValue("Application", "Video");
if visible == "" then
    visible = Dialog.Message("Visible videos", "Do you want the Video Objects to be visible?", MB_YESNO);
    Application.SaveValue("Application", "Video", visible);
end

if String.ToNumber(visible) == 7 then
    Video.SetVisible("Video1", false);
end

Note: 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:

visible = Dialog.Message("Visible videos", "Do you want the Video Objects to be visible?", MB_YESNO);
Application.SaveValue("Application", "Video", visible);