Description

The Player class is your point of entry to the WebGL runtime API. Using this class, you can initialize the animation and control its playback.

Syntax

new flwebgl.Player()

Properties

Name Type Description
S_OK number  
E_ERR number Generic error code
E_INVALID_PARAM number Invalid parameters passed to the function
E_CONTEXT_CREATION_FAILED number WebGL is not supported in the browser
E_REQUIRED_EXTENSION_NOT_PRESENT number WebGL is not supported in the browser
E_RESOURCE_LOADING_FAILED number Resource loading failed

Methods

getBackgroundColor()

Description

     This method returns the background color of the stage.

Returns

  • Type - flwebgl.geom.Color

getScenegraphFactory()

Description

     This method returns a factory for movie clip instances.

Returns

  • Type - flwebgl.sg.SceneGraphFactory  

getStage()

Description

    This method returns a reference to the stage.

Returns

  • Type - flwebgl.sg.MovieClip

getStageHeight()

Description

    This method returns the height of the stage in pixels.

Returns

  • Type - number  

getStageWidth()

Description

     This method returns the width of the stage in pixels.

Returns

  • Type - number

init(canvas, content, textures, callback)

Description

This method initializes the application with the resources and canvas. Resource loading is asynchronous. The supplied callback function is called after the resource loading is complete.

Parameters

Name Type Description
canvas HTMLCanvasElement The target canvas element
content Object The content JSON object
textures Array An array of TextureAtlas objects
callback Function The callback function to be called after all the resources are loaded

Returns

  • Returns S_OK if initialization succeeded, otherwise returns an appropriate error code
  • Type - number  

play(scene)

Description

This method plays the animation.

Parameters

Name Type Description
scene string (optional ) The scene to play. If not specified, all scenes are played.

Returns

  • Type - boolean

setViewport(viewport)

Description

This method sets the viewport.

Parameters

Name Type Description
viewport flwebgl.geom.Rect The viewport to be set

stop()

Description

    This method stops the animation.

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy