Variables

Some events in AutoPlay Media Studio contain variables whose values are automatically set whenever that event is triggered. These variables are called event variables. Event variables are local to the event and can be found on some page, dialog and object events. When we say they are "local," we mean their values are only available for actions created on that event.

Note: You can find additional information about each event variable by looking at the list of events.

The following event variables are available in AutoPlay Media Studio:

e_Button

(number) The index of the button that was pressed. This variable is only available on the On Mouse Button Down, On Mouse Button Up and On Mouse Move events of a QuickTime object.

CONSTANT

VALUE

DESCRIPTION

BUTTON_LEFT

1

Left mouse button.

BUTTON_RIGHT

2

Right mouse button.

BUTTON_MIDDLE

3

Middle mouse button.

e_Channel

(number) The audio channel whose state has changed. This variable is only available on the On Audio event. One of the following channel values will be returned:

CONSTANT

VALUE

DESCRIPTION

CHANNEL_BACKGROUND

5

Background audio channel.

CHANNEL_EFFECTS

0

Effects channel (used for mouse over, down, and click sounds).

CHANNEL_NARRATION

6

Narration channel (used for voice overs).

CHANNEL_USER1

1

User channel 1.

CHANNEL_USER2

2

User channel 2.

CHANNEL_USER3

3

User channel 3.

CHANNEL_USER4

4

User channel 4.

CHANNEL_ALL

-3

All audio channels.

e_Char

(number) The character code of the key that was pressed in an input object. This variable is only available on the On Char event of input objects.

e_Checked

(boolean) True if a node in the tree object has been checked, false if it has been unchecked. This variable is only available on the On Check event.

e_Column

(number) The column (0-based) of the cell that now has focus in a grid object. This variable is available on the grid object's On Selection Changed event.

The column (0-based) of the cell that changed in a grid object. This variable is available on the grid object's On Cell Changed event.

e_Delta

(number) The distance that the mouse wheel was rotated while on a page or dialog. A negative value indicates that the mouse wheel was rotated backward towards the user, and a positive value indicates that the mouse wheel was rotated forward away from the user. This can be altered by the user via their mouse software. This value will usually be 120 or -120, however may be multiples or divisions of 120 depending upon the mouse vendor. This variable is only available on a page's or dialog's On Mouse Wheel event.

e_DialogHeight

(number) The height of the current dialog. This variable is only available on the On Size event.

e_DialogWidth

(number) The width of the current dialog.  This variable is only available on the On Size event.

e_ErrorCode

(number) The numeric code of the error that has occurred in a QuickTime object. This variable is only available on the On Error event.

e_ErrorOrigin

(number) Where the error originated from in a QuickTime object. This variable is only available on the On Error event.

CONSTANT

VALUE

DESCRIPTION

qtErrorEventOriginControl

0

An error occurred in the QTControl area of the QuickTime ActiveX control.

qtErrorEventOriginMovie

1

An error occurred in the QTMovie area of the QuickTime ActiveX control.

qtErrorEventOriginQuickTime

2

An error occurred in the QTQuickTime area of the QuickTime ActiveX control.

e_Expanded

(boolean) True if a node in the tree object has been expanded, false if it has been collapsed. This variable is only available on the On Expanded event.

e_FilePath

(string) The full path to the image file that was changed to in the slideshow (currently shown).

e_Flags

(table) A table containing five boolean values that describe which modifier keys or buttons were held down when the On Mouse Wheel event is fired on a page or dialog.
 

There are five true/false values in the table: shift key, ctrl key, left mouse button, middle mouse button, and right mouse button. You can access these values as e_Flags.shift, e_Flags.ctrl, e_Flags.LButton, e_Flags.MButton, and e_Flags.RButton.

e_FSArgs

(string) A string containing the arguments of the last FSCommand fired within the Flash object. This variable is only available on the On FSCommand event.

e_FSCommand

(string) A string containing the last FSCommand fired within the Flash object. This variable is only available on the On FSCommand event.

e_Hyperlink

(string) A string containing the hyperlink text that the user clicked on a markup enabled xButton object. This is the text surrounded by Hyperlink tags in its markup text. For example, "Link Text" would be returned if the markup text contained <Hyperlink>Link Text</Hyperlink>. This variable is only available on the xButton object's On Hyperlink event.

e_ID

(number) The item ID of the menu item currently being interacted with.

e_Index

(number) The 1-based index of the slide that was changed to in the slideshow (currently shown).

e_ItemInfo

(table) Extended information about the currently selected menu item.

KEY

TYPE

DESCRIPTION

Text

string

The text of the menu item currently being interacted with.

ID

number

The item ID of the menu item currently being interacted with.

IconID

number

The 0-based icon index from the Image List specified on the Menu Bar for the menu item.

Enabled

boolean

True if the current menu item is enabled, false if it is not.

Checked

boolean

True if the current menu item is checked, false if it is not.

e_Key

(number) The virtual key code of the key that was pressed. This variable is only available on the On Key event.

e_Link

(string) The text of the link that was clicked. This variable is only available on the On Link event.

e_Max

(number) The 1-based character index where the link's text ends. This variable is only available on the On Link and On Selection Changed events.

e_Min

(number) The 1-based character index where the link's text begins. This variable is only available on the On Link and On Selection Changed events.

e_Modifiers

(table) A table containing three boolean values that describe which modifier keys were held down while the key was pressed, or for a QuickTime object, which mouse button was pressed. A modifier key is a key that can be held down while another key is pressed, to "modify" it.

There are three true/false values in the table, one for each type of modifier key on the keyboard: shift, ctrl, and alt. You can access these values as e_Modifiers.shift, e_Modifiers.ctrl, and e_Modifiers.alt. This variable is available on the On Key event, the On Mouse Button Down, On Mouse Button Up and On Mouse Move events of a QuickTime object, and the On Char event of the input object.

e_NewText

(string) The text that has just been set for a node in the tree object. This variable is available on a tree object's On EditLabel event.

The new text of the cell in grid object. This variable is available on a grid object's On Cell Changed event.

e_NodeIndex

(string) The index of a node in the tree object.

e_OldText

(string) The text that existed previously before the user edited the text of a node in the tree object. This variable is available on a tree object's On EditLabel event.

The text that was in the cell before it was changed in a grid object. This variable is available on a grid object's On Cell Changed event.

e_PageHeight

(number) The height of the current page. This variable is only available on the On Size event.

e_PageWidth

(number) The width of the current page. This variable is only available on the On Size event.

e_Rate

(number) The new rate of the media file. This variable is only available on the On Rate Change event.

e_Row

(number) The row (0-based) of the cell that now has focus in a grid object. This variable is available on the grid object's On Selection Changed event.

 The row (0-based) of the cell that changed in a grid object. This variable is available on the grid object's On Cell Changed event.

e_Selection

(number) The index of a comboxbox item that is being selected. (The first item in the list has an index of 1.) This variable is only available on the On Select event of a combobox object.

e_State

(string) A string containing the current state of the audio channel. This variable is only available on the On Audio event. One of the following states will be returned:

VALUE

TYPE

DESCRIPTION

Finish

string

The audio channel's track reached it's end.

Pause

string

The audio channel was paused using the Audio.Pause action.

Play

string

The audio channel was played using the Audio.Play action

Stop

string

The audio channel was stopped using the Audio.Stop action.

e_Type

(number) The type of resize that has occurred if on the On Size event, or the type of mouse button click if on the On Mouse Button event.

On Size e_Type constants:

CONSTANT

VALUE

DESCRIPTION

SIZE_RESTORED

0

The application was either restored from being maximized or minimized or was resized normally.

SIZE_MINIMIZED

1

The application was minimized to the taskbar.

SIZE_MAXIMIZED

2

The application was maximized.

On Mouse Button e_Type constants:

CONSTANT

VALUE

DESCRIPTION

LEFT_BUTTON_DOWN

0

Left mouse button has been pressed.

LEFT_BUTTON_UP

1

Left mouse button has been released.

RIGHT_BUTTON_DOWN

2

Right mouse button has been pressed.

RIGHT_BUTTON_UP

3

Right mouse button has been released.

e_URL

(string) A string containing the URL that has finished loading or is being navigated to. This variable is only available on the On Loaded and On Navigate events.

e_WindowHeight

(number) The height, in pixels, of the entire application window, including the border and title bar.  This variable is only available on the On Size event.

e_WindowWidth

(number) The width, in pixels, of the entire application window, including the border and title bar.  This variable is only available on the On Size event.

e_X

(number) The horizontal position of the mouse cursor, in pixels, from the left side of the page or dialog. This variable is only available on the On Mouse Button, On Mouse Move events, On Mouse Button Down, On Mouse Button Up and On Mouse Move events of a QuickTime object, and On Mouse Wheel event of a page or dialog.

e_XObject

(number) The horizontal position of the mouse cursor, in pixels, from the left side of a QuickTime object. This variable is only available on the On Mouse Button Down, On Mouse Button Up and On Mouse Move events of a QuickTime object.

e_Y

(number) The vertical position of the mouse cursor, in pixels, from the right side of the page or dialog. This variable is only available on the On Mouse Button, On Mouse Move events, On Mouse Button Down, On Mouse Button Up and On Mouse Move events of a QuickTime object, and On Mouse Wheel event of a page or dialog.

e_YObject

(number) The vertical position of the mouse cursor, in pixels, from the right side of a QuickTime object. This variable is only available on On Mouse Button Down, On Mouse Button Up and On Mouse Move events of a QuickTime object.

this

(string) A string containing the name of the object, page or dialog where the event is located. This variable is useful for creating generic actions or functions that are not dependent on specific page, dialog, or object names. For example:

Label.SetVisible(this, false);

This action hides the label object it was created on. For example, if the action was created on the object named "Label1", it would hide the Label1 object. If it was created on the object called "Label2", it would hide the Label2 object.

Example 1: e_Channel, e_State

Often its necessary to be able to detect when an audio track has reached its end so you can respond with some type of action. This example illustrates how to jump to another page when an audio track playing in the narration audio channel reaches the end. Using this design, the visual presentation could be controlled by an audio voice over.

  1. Create a two page project with your second page called "Page2".

  2. Add the following code to the On Show event of your first page. An audio file is needed for this example, so you will need to modify this action so it loads an actual audio file within your project.

- Load a narration track into the narration channel.
Audio.Load(CHANNEL_NARRATION, "AutoPlay\\Audio\\Lesson1.ogg", true, false);

  1. Add the following code to the On Audio event of your first page.

-- If the narration audio channel's track reaches the end, jump to another page.
if ((e_Channel == CHANNEL_NARRATION) and (e_State == "Finish")) then
    Page.Jump("Page2");
end

If you preview your project, the audio file will begin to play when the first page opens. Once that audio track has reached the end, the second page will display.

Example 2: e_Key

In most cases, interaction with an AutoPlay application is accomplished using the mouse. However it's also possible to control some of the functionality through the keyboard by responding to certain key strokes. This example illustrates how navigation can be controlled by key strokes if a mouse is not available.

  1. Create a project with two or more pages.

  2. Add the following code to the On Key event of each page.

-- If the user presses the Enter key, jump to the next page in the project.
if (e_Key == 13) then
    Page.Navigate(PAGE_NEXT);
end

When you preview your project, each time you press the "Enter" key, the next page will be displayed. In the example code, the event variable e_Key is compared to the number 13 which is the virtual key code value for the "Enter" key (carriage return).

Сайт управляется системой uCoz