This page has been translated automatically.
UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
Plugins Library
High-Level Systems
Samples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
Content Creation
Materials
Unigine Material Library
Tutorials
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

WidgetFlash Class

This class creates a widget with a Flash movie (.swf).

Warning
Flash is no longer under development, please use other solutions for in-app GUIs.

Text

In case very slow vector fonts are used instead of fast and anti-aliased raster ones, a Flash movie can cause a performance drop. To avoid such situation, follow these advices.

  1. Use only the following embeded fonts:
    • _sans
    • _serif
    • _typewriter
  2. Use TTF fonts. An appropriate *.ttf file should be placed under the data directory.
    • sans.ttf instead of _sans flash font
    • serif.ttf instead of _serif flash font
    • typewriter.ttf instead of _typewriter flash font
    • common_name.ttf instead of common_name flash font
    • i postfix for italic type (for example, sansi.ttf).
    • b postfix for bold type (for example, sansb.ttf).
    • ib postfix for bold italics (for example, sansib.ttf).

Notice
To avoid adding HTML tags to texts, in Publish settings specify Player: Flash Player 7.

The following samples demonstrate the usage of the WidgetFlash class:

WidgetFlash Class

This class inherits from Widget

Members


WidgetFlash (Gui gui, string name)

Constructor. Creates a flash movie widget.

Arguments

  • Gui gui - GUI, to which the canvas will belong.
  • string name - Path to the flash movie.

int getActivity ()

Checks if the mouse cursor is currently over a flash sprite or a button that can recieve notifications of mouse events.

Return value

1 if the mouse is over an interactive flash element; otherwise, 0.

void getArray (string name, int id)

Returns the current values of the given ActionScript array.

Arguments

  • string name - Array object name.
  • int id - ID of the return array of values.

int getBitmapImage (string name, Image image)

Returns a bitmap image set for a flash element by its linkage identifier.

Arguments

  • string name - Linkage identifier.
  • Image image - Image to write into.

Return value

1 if the image was successfully written; otherwise, 0.

int getFlashHeight ()

Returns the real height of a flash movie as stored in a file.

Return value

Flash movie height in units.

int getFlashWidth ()

Returns the real width of a flash movie as stored in a file.

Return value

Flash movie width in units.

float getFontScale ()

Returns the scale for the loaded TTF fonts. For example, the value of 2 means the font will be two times bigger. This function allows to control the accuracy of the font when it is rendered onto the screen.

Return value

TTF font scale.

int getFrame ()

Returns the set frame of the flash movie to be played.

Return value

Frame number.

int getNumDips ()

Returns the number draw calls that were required to render the loaded Flash movie frame.

Return value

The number of draw calls.

int getNumFrames ()

Returns the total number of frames in the flash movie.

Return value

Total number of frames.

int getNumLines ()

Returns the number of lines drawn during a Flash movie frame.

Return value

The number of drawn lines.

int getNumTriangles ()

Returns the number of triangles drawn during a Flash movie frame.

Return value

The number of drawn triangles.

float getRenderTime ()

Returns the time value, required to prepare all data to be rendered in the current frame and feed rendering commands from the CPU to the GPU. See the Profiler article for details.

Return value

Rendering time value, milliseconds.

float getThresholdScale ()

Returns the multiplier for the number of control points in splines. For example, the value of 2 means the splines will have twice as much control points. This function allows to control the smoothness of spline line when rendered onto the screen.

Return value

Spline points multiplier.

float getUpdateTime ()

Returns the time value, required to update an application logic. See the Profiler article for details.

Return value

Update time value, milliseconds.

variable getVariable (string name)

Returns the current value of the given ActionScript variable.

Arguments

  • string name - Variable name.

Return value

Variable value.

int isArray (string name)

Checks if the given object is an ActionScript array.

Arguments

  • string name - Array name.

Return value

1 if it is an AnctionScript array; otherwise, 0.

int isFunction (string name)

Checks if the given function is an ActionScript function.

Arguments

  • string name - Function name.

Return value

1 if it is an AnctionScript function; otherwise, 0.

int isLoaded ()

Checks if a flash movie is successfully loaded.

Return value

1 if the movie is loaded; otherwise, 0.

int isPlaying ()

Returns a value indicating if flash movie is currently playing.

Return value

1 if the flash movie is played; otherwise, 0.

int isStopped ()

Returns a value indicating if flash movie playback is currently stopped.

Return value

1 if the flash movie is stopped; otherwise, 0.

int isVariable (string name)

Checks if the given variable is an ActionScript variable.

Arguments

  • string name - Variable name.

Return value

1 if it is an AnctionScript variable; otherwise, 0.

void play ()

Starts playback of the flash movie.

variable runFunction (string name)

Run an ActionScript function without arguments.

Arguments

  • string name - Function name.

Return value

Function return variable.

variable runFunction (string name, variable v0)

Run an ActionScript function with one argument.

Arguments

  • string name - Function name.
  • variable v0 - Function argument.

Return value

Function return variable.

variable runFunction (string name, variable v0, variable v1)

Run an ActionScript function with two arguments.

Arguments

  • string name - Function name.
  • variable v0 - The first function argument.
  • variable v1 - The second function argument.

Return value

Function return variable.

variable runFunction (string name, variable v0, variable v1, variable v2)

Run an ActionScript function with three arguments.

Arguments

  • string name - Function name.
  • variable v0 - The first function argument.
  • variable v1 - The second function argument.
  • variable v2 - The third function argument.

Return value

Function return variable.

variable runFunction (string name, variable v0, variable v1, variable v2, variable v2)

Run an ActionScript function with four arguments.

Arguments

  • string name - Function name.
  • variable v0 - The first function argument.
  • variable v1 - The second function argument.
  • variable v2 - The third function argument.
  • variable v2 - The fourth function argument.

Return value

Function return variable.

void setArray (string name, int id)

Set new values for the given ActionScript array.

Arguments

  • string name - Array object name.
  • int id - ID of the array of values to be set.

int setBitmapImage (string name, Image image)

Sets a new bitmap image for a flash element by its linkage identifier.

Arguments

  • string name - Linkage identifier.
  • Image image - Image to set.

Return value

1 if the image was successfully set; otherwise, 0.

void setFontScale (float scale)

Sets the scale only for the loaded TTF fonts. For example, the value of 2 means the font will be two times bigger. This function allows to control the accuracy of the font when it is rendered onto the screen. The default is 1.

Arguments

  • float scale - TTF font scale. If a negative value is provided, 0 will be used instead.

int setFrame (int frame)

Sets the frame of the flash movie to be played.

Arguments

  • int frame - Frame number.

Return value

1 if the frame was successfully set; otherwise, 0.

void setThresholdScale (float scale)

Sets the multiplier for the number of control points in splines. For example, the value of 2 means the splines will have twice as much control points. This function allows to control the smoothness of spline line when rendered onto the screen. The default is 1.

Arguments

  • float scale - Spline points multiplier. If a negative value is provided, 0 will be used instead.

void setVariable (string name, variable v)

Set a new value for the given ActionScript variable.

Arguments

  • string name - Variable name.
  • variable v - Variable value.

void stop ()

Stops playback of the flash movie. This function saves the playback position so that playing of the file can be resumed from the same point.
Last update: 2017-07-03
Build: ()