FlashPlayer (SUI)

A control that contains a Flash Player, which can load and play Flash movies stored in SWF files.

The ScriptUI FlashPlayer element runs the Flash application within an Adobe application. The Flash application runs ActionScript, a different implementation of JavaScript from the ExtendScript version of JavaScript that Adobe applications run. A control object of this type contains functions that allow your script to load SWF files, control movie playback, and communicate with the ActionScript environment.

Methods:

addEventListener, callback, dispatchEvent, hide, invokePlayerFunction, loadMovie, notify, playMovie, removeEventListener, show, stopMovie

Objects:

Boolean, Bounds (SUI), Dimension (SUI), Number, Object, Point (SUI), String, Window (SUI)

Property Listing

Property

Type

Access

Description

active

Boolean

read/write

True if this element is active.

An active control is the one with keyboard focus—that is, the one that accepts keystrokes, or in the case of a Button, is selected when the user types Return or Enter in Windows, or the space bar in Mac OS.

alignment

String

read/write

The alignment style for this element. If defined, this value overrides the alignChildren setting for the parent container.

This can be a single string, which indicates the alignment for the orientation specified in the parent container, or an array of two strings, indicating both the horizontal and vertical alignment (in that order). Allowed values depend on the orientation value of the parent container. They are not case sensitive. For orientation=row:top, bottom, fill For orientation=column: left, right, fill For orientation=stack:top, bottom, left, right, fill

bounds

Bounds (SUI)

read/write

The boundaries of the element, in parent-relative coordinates.

Setting an element's size or location changes its bounds property, and vice-versa.

enabled

Boolean

read/write

True if this element is enabled.

An enabled element can accept input, according to its type. When false, control elements do not accept input, and all types of elements have a dimmed appearance.

helpTip

String

read/write

The help text that is displayed when the mouse hovers over the element.

indent

Number

read/write

The number of pixels to indent the element during automatic layout.

Applies for column orientation and left alignment, or row orientation and top alignment.

location

Point (SUI)

read/write

The upper left corner of this element relative to its parent.

The location is defined as [bounds.x, bounds.y]. Setting an element's location changes its bounds property, and vice-versa.

maximumSize

Dimension (SUI)

read/write

The maximum height and width to which the element can be resized.

minimumSize

Dimension (SUI)

read/write

The minimum height and width to which the element can be resized.

parent

 

readonly

The parent element.

preferredSize

Dimension (SUI)

read/write

The preferred size, used by layout managers to determine the best size for each element.

If not explicitly set by a script, value is established by the UI framework in which ScriptUI is employed, and is based on such attributes of the element as its text, font, font size, icon size, and other UI framework-specific attributes.A script can explicitly set this value before the layout manager is invoked in order to establish an element size other than the default.

properties

Object

read/write

An object that contains one or more creation properties of the container (properties used only when the element is created).

A FlashPlayer object has no creation properties.

size

Dimension (SUI)

read/write

The current dimensions of this element.

Initially undefined, and unless explicitly set by a script, it is defined by a LayoutManager . A script can explicitly set size before the layout manager is invoked to establish an element size other than the preferredSize or the default size, but this is not recommended. Defined as [bounds.width, bounds.height]. Setting an element's size changes its bounds property, and vice-versa.

type

String

readonly

The element type, "flashplayer".

visible

Boolean

read/write

True if this element is shown, false if it is hidden.

When a container is hidden, its children are also hidden, but they retain their own visibility values, and are shown or hidden accordingly when the parent is next shown.

window

Window (SUI)

readonly

The window that this element belongs to.

windowBounds

Bounds (SUI)

readonly

The bounds of this element relative to the top-level parent window.

Method Listing

Boolean addEventListener (eventName:String, handler:Function, capturePhase:Boolean=Boolean)

Registers an event handler for a particular type of event occuring in this element.

Parameter

Type

Description

eventName

String

The name of the event.

Event names are listed in the JavaScript Tools Guide.

handler

Function

The function that handles the event.

This can be the name of a function defined in the extension, or a locally defined handler function to be executed when the event occurs. A handler function takes one argument, the UIEvent object.

capturePhase

Boolean

When true, the handler is called only in the capturing phase of the event propagation.

Default is false, meaning that the handler is called in the bubbling phase if this object is an ancestor of the target, or in the at-target phase if this object is itself the target.

(default: false)

undefined callback ()

A function definition for a callback from the Flash ActionScript environment.

The Flash ActionScript code can call any callback function defined on the ExtendScript side of the FlashPlayer object, invoking it by name as a property of the control object. The function can take any arguments of a supported data types, and can return any value of a supported data type. data types:Number, String, Boolean, null, undefined, Object, Array.

Event (SUI) dispatchEvent ()

Simulates the occurrence of an event in this target.

A script can create a UIEvent object for a specific event and pass it to this method to start the event propagation for the event.

undefined hide ()

Hides this element.

VariesSUI invokePlayerFunction (name:String, [argument:VariesSUI])

Invokes an ActionScript function defined in the Flash application.

Returns the result of the invoked function, which must be one of the allowed types. The ActionScript class and date objects are not supported as return values.

Parameter

Type

Description

name

String

The name of a Flash ActionScript function that has been registered with the ExternalInterface object by the currently loaded SWF file.

argument

VariesSUI

An argument to pass through to the function.

There can be any number of arguments. An argument must be one of these data types:Number, String, Boolean, null, undefined, Object, Array. No other data types are supported.

undefined loadMovie (file:File)

Loads a movie into the Flash Player, and begins playing it.

Parameter

Type

Description

file

File

The File object for the SWF file to load.

undefined notify ([eventName:String])

Sends a notification message, simulating the specified user interaction event.

Parameter

Type

Description

eventName

String

The name of the control event handler to call.

One of: onClick, onChange, onChanging. By default, simulates the onChange event for an edittext control, an onClick event for controls that support that event.

undefined playMovie (rewind:Boolean=Boolean)

Restarts a movie that has been stopped.

Do not use on a movie that is currently playing.The stopMovie()-playMovie() sequence does not work for SWF files produced by Flex, or for some files produced by Flash Authoring (depending on how they were implemented).

Parameter

Type

Description

rewind

Boolean

When true, restarts the movie from the beginning; otherwise, starts playing from the point where it was stopped.

(default: false)

Boolean removeEventListener (eventName:String, handler:Function, capturePhase:Boolean=Boolean)

Unregisters an event handler for a particular type of event occuring in this element.

All arguments must be identical to those that were used to register the event handler.

Parameter

Type

Description

eventName

String

The name of the event.

handler

Function

The function that handles the event.

capturePhase

Boolean

Whether to call the handler only in the capturing phase of the event propagation.

(default: false)

undefined show ()

Shows this element.

When a window or container is hidden, its children are also hidden, but when it is shown again, the children retain their own visibility states.

undefined stopMovie ()

Halts playback of the current movie.

The stopMovie()-playMovie() sequence does not work for SWF files produced by Flex, or for some files produced by Flash Authoring (depending on how they were implemented).Using stopMovie() from the player's hosting environment has no effect on an SWF file playing in a ScriptUI Flash Player element. It is, however, possible to produce an SWF using Flash Authoring that can stop itself in response to user interaction.