Class: FlashStage

FlashStage(opts, wmodeopt, swfPath)

A Stage implementation using Flash.

Constructor

new FlashStage(opts, wmodeopt, swfPath)

Parameters:
Name Type Attributes Default Description
opts Object
wmode String <optional>
'transparent'

Flash wmode property. Read this for more information.

swfPath String

Path to the SWF file. By default, the SWF is assumed to be named marzipano.swf and located in the same directory as marzipano.js.

Extends

Members

type

The stage type, used to determine the appropriate renderer for a given geometry and view.

Known values are "webgl", "css" and "flash".

See also Stage#registerRenderer.

Properties:
Type Description
string
Overrides:

Methods

addLayer(layer, i)

Adds a layer into the stage.

Parameters:
Name Type Description
layer Layer

The layer to add.

i number | undefined

The optional position, where 0 ≤ i ≤ n and n is the current number of layers. The default is n, which inserts at the top of the display stack.

Inherited From:
Throws:

An error if the layer already belongs to the stage or if the position is invalid.

createTexture(tile, asset, done)

Create a texture for the given tile and asset. Called by TextureStore.

Parameters:
Name Type Description
tile Tile
asset Asset
done function
Inherited From:

destroy()

Destructor.

Overrides:

domElement() → {Element}

Returns the underlying DOM element.

Overrides:
Returns:
Type
Element

endFrame()

Called after a frame is rendered.

Must be overridden by subclasses.

Overrides:

flashElement() → {Element}

Returns the underlying Flash element.

Returns:
Type
Element

hasLayer(layer) → {boolean}

Return whether a layer belongs to the stage.

Parameters:
Name Type Description
layer Layer
Inherited From:
Returns:
Type
boolean

height() → {number}

Get the stage height.

Inherited From:
Returns:
Type
number

listLayers() → {Array.<Layer>}

Returns a list of all layers belonging to the stage. The returned list is in display order, background to foreground.

Inherited From:
Returns:
Type
Array.<Layer>

loadImage(url, rectnullable, done) → {function}

Loads an Asset from an image.

Parameters:
Name Type Attributes Description
url string

The image URL.

rect Rect <nullable>

A Rect describing a portion of the image, or null to use the full image.

done function

The callback.

Overrides:
Returns:

A function to cancel loading.

Type
function

moveLayer(layer, i)

Moves a layer into a different position in the display stack.

Parameters:
Name Type Description
layer Layer

The layer to move.

i number

The position, where 0 ≤ i ≤ n-1 and n is the current number of layers.

Inherited From:
Throws:

An error if the layer does not belong to the stage or if the position is invalid.

registerRenderer(geometryType, viewType, Renderer)

Registers a Renderer for the given Geometry and View type.

The registerDefaultRenderers utility function may be used to register all known renderers for a stage type into that stage. Most users will not need to register renderers, as Viewer does it for them.

Parameters:
Name Type Description
geometryType string

The geometry type, as given by Geometry#type.

viewType string

The view type, as given by View#type.

Renderer *

The renderer class.

Inherited From:

removeAllLayers()

Removes all layers from the stage.

Inherited From:

removeLayer(layer)

Removes a Layer from the stage.

Parameters:
Name Type Description
layer Layer

The layer to remove.

Inherited From:
Throws:

An error if the layer does not belong to the stage.

render()

Render the current frame. Usually called from a RenderLoop.

This contains the rendering logic common to all stage types. Subclasses define the startFrame() and endFrame() methods to perform their own logic.

Inherited From:

setSize(size)

Set the stage dimensions.

This contains the size update logic common to all stage types. Subclasses must define the Stage#setSizeForType method to perform their own logic.

Parameters:
Name Type Description
size Size
Inherited From:

setSizeForType(size)

Call Stage#setSize instead.

This contains the size update logic specific to a stage type. It is called by Stage#setSize after the base class has been updated to reflect the new size, but before any events are emitted.

Parameters:
Name Type Description
size Size
Overrides:

size(sizeopt)

Get the stage dimensions. If an argument is supplied, it is filled in with the result and returned. Otherwise, a fresh object is filled in and returned.

Parameters:
Name Type Attributes Description
size Size <optional>
Inherited From:

startFrame()

Called before a frame is rendered.

Must be overridden by subclasses.

Overrides:

validateLayer(layer)

Verifies that the layer is valid for this stage, throwing an exception otherwise.

Parameters:
Name Type Description
layer Layer
Overrides:
Throws:

If the layer is not valid for this stage.

Type
Error

width() → {number}

Get the stage width.

Inherited From:
Returns:
Type
number

Events

renderComplete

Signals that a render is complete.

Parameters:
Name Type Description
Whether boolean

all tiles were successfully rendered without missing textures or resorting to fallbacks.

Inherited From:

renderInvalid

Signals that the contents of the stage have been invalidated and must be rendered again.

This is used by the RenderLoop implementation.

Inherited From: