Packagecom.panosalado.core
Classpublic class PanoSalado
InheritancePanoSalado Inheritance ViewData Inheritance flash.display.Sprite
ImplementsICamera

Displays panoramic images. Implements the Model, View, Controller paradigm. The Model is the ViewData superclass, which extends Sprite. (This is done so that view data properties are directly gettable / settable on an instance of PanoSalado. The View is this class, along with a helper class like Panorama, which renders the panorama. In the case of Panorama, the panorama is rendered as a vector to a Graphics object. However, other renders could be implemented. The Controllers are all optional and are passed in an array into the initialize() function. Finally, this class contains a variety of public methods for modifying the ViewData model class to aid in implementing "usual suspect" type functionality: loadPanorama(), renderAt(), swingTo(), swingToChild(), startInertialSwing(), stopInertialSwing(), etc. The functionalities of all of these convenience methods can also be had through direct manipulation of the ViewData properties.



Public Properties
 PropertyDefined by
 Inherited_boundsHeight : Number
Height of panorama.
ViewData
 InheritedboundsHeight : Number
Height of rendered panorama.
ViewData
 Inherited_boundsWidth : Number
Width of panorama.
ViewData
 InheritedboundsWidth : Number
Width of rendered panorama.
ViewData
  canvas : Sprite
[read-only] The Sprite whose x,y values can be used to move the primary panorama.
PanoSalado
  canvasInternal : Sprite
[read-only] The Sprite whose graphics object is used to draw the primary panorama.
PanoSalado
  children : Sprite
[read-only] The Sprite which is the container for all children which do NOT extend ManagedChild.
PanoSalado
 Inherited_fieldOfView : Number
Field of view.
ViewData
 InheritedfieldOfView : Number
Field of view.
ViewData
 InheritedfrustumBottom : Vector3D
Bottom frustum plane as determined by field of view.
ViewData
 InheritedfrustumLeft : Vector3D
Left frustum plane as determined by field of view.
ViewData
 InheritedfrustumRight : Vector3D
Right frustum plane as determined by field of view.
ViewData
 InheritedfrustumTop : Vector3D
Top frustum plane as determined by field of view.
ViewData
 Inheritedinvalid : Boolean
Invalidation flag for all properties.
ViewData
 InheritedinvalidPerspective : Boolean
Invalidation flag for field of view, boundsWidth and boundsHeight, which determine perspectiveProjection and perspectiveMatrix3D
ViewData
 InheritedinvalidTransform : Boolean
Invalidation flag for pan and tilt, which determine the transformMatrix3D
ViewData
  managedChildren : Sprite
[read-only] The Sprite which is the container for all ManagedChild extending children of the primary panorama (hotspots usually).
PanoSalado
 Inherited_maximumFieldOfView : Number
Maximum field of view.
ViewData
 InheritedmaximumFieldOfView : Number
maximumFieldOfView
ViewData
 Inherited_maximumPan : Number
Maximum pan.
ViewData
 InheritedmaximumPan : Number
maximumPan
ViewData
 Inherited_maximumTilt : Number
Maximum tilt.
ViewData
 InheritedmaximumTilt : Number
maximumTilt
ViewData
 Inherited_minimumFieldOfView : Number
Minimum field of view.
ViewData
 InheritedminimumFieldOfView : Number
minimumFieldOfView
ViewData
 Inherited_minimumPan : Number
Minimum pan.
ViewData
 InheritedminimumPan : Number
minimumPan
ViewData
 Inherited_minimumTilt : Number
Minimum tilt.
ViewData
 InheritedminimumTilt : Number
minimumTilt
ViewData
  numChildren : int
[read-only]
PanoSalado
 Inherited_pan : Number
Pan angle.
ViewData
 Inheritedpan : Number
Pan angle.
ViewData
 Inherited_path : String
Path for panorama.
ViewData
 Inheritedpath : String
Path.
ViewData
 InheritedperspectiveMatrix3D : Matrix3D
Matrix3D from perspectiveProjection.toMatrix3d().
ViewData
 InheritedperspectiveProjection : PerspectiveProjection
PerspectiveProjection set from field of view, boundsWidth and boundsHeight.
ViewData
 InheritedpixelsPerDegree : Number
Pixels per degree as determined from field of view, boundsWidth and boundsHeight.
ViewData
  secondaryCanvas : Sprite
[read-only] The Sprite whose x,y values can be used to move the secondary, outgoing panorama.
PanoSalado
  secondaryCanvasInternal : Sprite
[read-only] The Sprite whose graphics object is used to draw the secondary panorama.
PanoSalado
  secondaryManagedChildren : Sprite
[read-only] The Sprite which is the container for all ManagedChild extending children of the secondary panorama (hotspots).
PanoSalado
 InheritedsecondaryViewData : DependentViewData
Secondary ViewData, which is used for the secondary (outgoing) panorama.
ViewData
 Inherited_tierThreshold : Number
Tier threshold.
ViewData
 InheritedtierThreshold : Number
Tier Threshold.
ViewData
 Inherited_tile : Tile
Tile.
ViewData
 Inheritedtile : Tile
The root tile in the tile linked list data structure.
ViewData
 Inherited_tilt : Number
Tilt angle.
ViewData
 Inheritedtilt : Number
Tilt angle.
ViewData
 InheritedtransformMatrix3D : Matrix3D
Matrix3D recomposed from pan and tilt angles.
ViewData
Protected Properties
 PropertyDefined by
  _canvas : Sprite
PanoSalado
  _canvasInternal : Sprite
PanoSalado
  _children : Sprite
PanoSalado
 Inheritedconstructed : Boolean
ViewData
  _deltaPan : Number
PanoSalado
  _deltaTilt : Number
PanoSalado
  _dependencyRelay : DependencyRelay
PanoSalado
  _friction : Number
PanoSalado
  _managedChildren : Sprite
PanoSalado
  _now : int
PanoSalado
  _panSpeed : Number
PanoSalado
  _params : Object
PanoSalado
  _render : Function
PanoSalado
  _secondaryCanvas : Sprite
PanoSalado
  _secondaryCanvasInternal : Sprite
PanoSalado
  _secondaryManagedChildren : Sprite
PanoSalado
  _sensitivity : Number
PanoSalado
  _stageReference : StageReference
PanoSalado
  _threshold : Number
PanoSalado
  _tiltSpeed : Number
PanoSalado
Public Methods
 MethodDefined by
  
Constructor.
PanoSalado
  
_getChildAt(index:int, managed:Boolean):DisplayObject
Allows access to getChildAt() to get a managed or normal child depending on the managed switch
PanoSalado
  
_getChildByName(name:String, managed:Boolean):DisplayObject
Allows access to getChildByName() to get a managed or normal child depending on the managed switch
PanoSalado
  
_removeChildAt(index:int, managed:Boolean):DisplayObject
Allows access to removeChildAt() for a managed or normal child depending on the managed switch
PanoSalado
  
_swapChildrenAt(index1:int, index2:int, managed:Boolean):void
Allows access to swapChildrenAt() for managed or normal children depending on the managed switch
PanoSalado
  
addChild(child:DisplayObject):DisplayObject
PanoSalado
  
addChildAt(child:DisplayObject, index:int):DisplayObject
PanoSalado
 Inherited
clone(into:ViewData = null):ViewData
Clones the properties of this view data object into another.
ViewData
  
contains(child:DisplayObject):Boolean
PanoSalado
  
getChildIndex(child:DisplayObject):int
PanoSalado
  
initialize(dependencies:Array):void
PanoSalado accepts an Array of Objects as dependencies for itself and for the other dependencies in the list.
PanoSalado
  
loadPanorama(params:Params):void
Loads a new panorama.
PanoSalado
  
processDependency(reference:Object, characteristics:*):void
PanoSalado
  
removeChild(child:DisplayObject):DisplayObject
PanoSalado
  
render(event:Event = null, viewData:ViewData = null):void
function that draws the panorama.
PanoSalado
  
renderAt(pan:Number, tilt:Number, fieldOfView:Number):void
Renders the panorama at the specified pan,tilt,fieldOfView.
PanoSalado
  
setChildIndex(child:DisplayObject, index:int):void
PanoSalado
  
startInertialSwing(panSpeed:Number, tiltSpeed:Number, sensitivity:Number = 0.0003, friction:Number = 0.3, threshold:Number = 0.0001):void
Starts inertial motion (like the InertialMouseCamera) with the specified panSpeed, tiltSpeed using the specified sensitivity, friction, and threshold.
PanoSalado
  
Stops the inertial motion caused by a call to startInertialSwing().
PanoSalado
  
swapChildren(child1:DisplayObject, child2:DisplayObject):void
PanoSalado
  
swingTo(pan:Number, tilt:Number, fieldOfView:Number, time:Number = 2.5, tween:Function = null):void
Swings the camera to the specified pan,tilt,fieldOfView over the specified time (in seconds) using the specified tween function (with a standard Robert Penner tween function signature).
PanoSalado
  
swingToChild(child:ManagedChild, fieldOfView:Number, time:Number = 2.5, tween:Function = null):void
Swings the camera to the specified ManagedChild, fieldOfView, over the specified time in seconds using the specified tween function (standard Robert Penner style signature).
PanoSalado
Protected Methods
 MethodDefined by
  
clearGraphics(e:Event):void
Clears the graphics objects if path or secondaryPath are null.
PanoSalado
  
commitPath(e:ReadyEvent, updateFOV:Boolean = true):void
Copies all the properties in the Params object received in loadPanorama to the current panorama.
PanoSalado
  
swingToChildComplete(e:Event):void
PanoSalado
  
updateChildren(container:Sprite, viewData:ViewData):void
Updates the position of all managedChildren of PanoSalado
PanoSalado
Events
 EventSummaryDefined by
   Dispatched before PanoSalado begins to change view properties as a result of API calls: loadPanorama, renderAt, swingTo, swingToChild, startInertialSwing/stopInertialSwing.PanoSalado
   Dispatched when a new panorama has loaded.PanoSalado
   Dispatched after PanoSalado finishes changing view properties as a result of API calls: loadPanorama, renderAt, swingTo, swingToChild, startInertialSwing/stopInertialSwing.PanoSalado
   Dispatched after a swingToChild is complete PanoSalado
   Dispatched after a swingTo is complete PanoSalado
Public Constants
 ConstantDefined by
 InheritedMAXIMUM_FOV : Number = 179.999999999999999999999
[static] Maximum renderable field of view
ViewData
 InheritedMINIMUM_FOV : Number = 0.000000000000000000001
[static] Minimum renderable field of view
ViewData
Property detail
_canvasproperty
protected var _canvas:Sprite
canvasproperty 
canvas:Sprite  [read-only]

The Sprite whose x,y values can be used to move the primary panorama. Also the Sprite on which the BlendMode is set to LAYER.

Implementation
    public function get canvas():Sprite
_canvasInternalproperty 
protected var _canvasInternal:Sprite
canvasInternalproperty 
canvasInternal:Sprite  [read-only]

The Sprite whose graphics object is used to draw the primary panorama. It's x,y is always at half the panorama's width, height.

Implementation
    public function get canvasInternal():Sprite
_childrenproperty 
protected var _children:Sprite
childrenproperty 
children:Sprite  [read-only]

The Sprite which is the container for all children which do NOT extend ManagedChild.

Implementation
    public function get children():Sprite
_deltaPanproperty 
protected var _deltaPan:Number
_deltaTiltproperty 
protected var _deltaTilt:Number
_dependencyRelayproperty 
protected var _dependencyRelay:DependencyRelay
_frictionproperty 
protected var _friction:Number
_managedChildrenproperty 
protected var _managedChildren:Sprite
managedChildrenproperty 
managedChildren:Sprite  [read-only]

The Sprite which is the container for all ManagedChild extending children of the primary panorama (hotspots usually). When a new panorama has loaded all current children will be re-parented to the secondaryManagedChildren Sprite. When a child is added to PanoSalado, its class is checked for ManagedChild and if true, it will be added to this Sprite and managed as part of the current panorama.

Implementation
    public function get managedChildren():Sprite
_nowproperty 
protected var _now:int
numChildrenproperty 
numChildren:int  [read-only]Implementation
    public function get numChildren():int
_panSpeedproperty 
protected var _panSpeed:Number
_paramsproperty 
protected var _params:Object
_renderproperty 
protected var _render:Function
_secondaryCanvasproperty 
protected var _secondaryCanvas:Sprite
secondaryCanvasproperty 
secondaryCanvas:Sprite  [read-only]

The Sprite whose x,y values can be used to move the secondary, outgoing panorama. Also the Sprite on which the BlendMode is set to LAYER.

Implementation
    public function get secondaryCanvas():Sprite
_secondaryCanvasInternalproperty 
protected var _secondaryCanvasInternal:Sprite
secondaryCanvasInternalproperty 
secondaryCanvasInternal:Sprite  [read-only]

The Sprite whose graphics object is used to draw the secondary panorama. It's x,y is always at half the panorama's width, height.

Implementation
    public function get secondaryCanvasInternal():Sprite
_secondaryManagedChildrenproperty 
protected var _secondaryManagedChildren:Sprite
secondaryManagedChildrenproperty 
secondaryManagedChildren:Sprite  [read-only]

The Sprite which is the container for all ManagedChild extending children of the secondary panorama (hotspots). When a new panorama has loaded all children will be removed from this Sprite, making them eligible for garbage collection if there are not other outstanding references to them.

Implementation
    public function get secondaryManagedChildren():Sprite
_sensitivityproperty 
protected var _sensitivity:Number
_stageReferenceproperty 
protected var _stageReference:StageReference
_thresholdproperty 
protected var _threshold:Number
_tiltSpeedproperty 
protected var _tiltSpeed:Number
Constructor detail
PanoSalado()constructor
public function PanoSalado()

Constructor.

Method detail
_getChildAt()method
public function _getChildAt(index:int, managed:Boolean):DisplayObject

Allows access to getChildAt() to get a managed or normal child depending on the managed switch

Parameters
index:int — int
 
managed:Boolean — Boolean

Returns
DisplayObject
_getChildByName()method 
public function _getChildByName(name:String, managed:Boolean):DisplayObject

Allows access to getChildByName() to get a managed or normal child depending on the managed switch

Parameters
name:String — String
 
managed:Boolean — Boolean

Returns
DisplayObject
_removeChildAt()method 
public function _removeChildAt(index:int, managed:Boolean):DisplayObject

Allows access to removeChildAt() for a managed or normal child depending on the managed switch

Parameters
index:int — int
 
managed:Boolean — Boolean

Returns
DisplayObject
_swapChildrenAt()method 
public function _swapChildrenAt(index1:int, index2:int, managed:Boolean):void

Allows access to swapChildrenAt() for managed or normal children depending on the managed switch

Parameters
index1:int — int
 
index2:int — int
 
managed:Boolean — Boolean
addChild()method 
public override function addChild(child:DisplayObject):DisplayObjectParameters
child:DisplayObject

Returns
DisplayObject
addChildAt()method 
public override function addChildAt(child:DisplayObject, index:int):DisplayObjectParameters
child:DisplayObject
 
index:int

Returns
DisplayObject
clearGraphics()method 
protected function clearGraphics(e:Event):void

Clears the graphics objects if path or secondaryPath are null.

Parameters
e:Event
commitPath()method 
protected override function commitPath(e:ReadyEvent, updateFOV:Boolean = true):void

Copies all the properties in the Params object received in loadPanorama to the current panorama.

Parameters
e:ReadyEvent
 
updateFOV:Boolean (default = true)

See also

loadPanorama
contains()method 
public override function contains(child:DisplayObject):BooleanParameters
child:DisplayObject

Returns
Boolean
getChildIndex()method 
public override function getChildIndex(child:DisplayObject):intParameters
child:DisplayObject

Returns
int
initialize()method 
public function initialize(dependencies:Array):void

PanoSalado accepts an Array of Objects as dependencies for itself and for the other dependencies in the list. This offers a means for any instance of a class passed in to the array to store a reference to any other instance of a class passed in to the array. PanoSalado uses flash.utils.getQualifiedClassName() on each dependency to create the characteristics object which provides an auxiliary means for the dependency to identify itself to other dependencies looking for it. (This is in addition to the actual reference to the dependency). Each dependency will be checked for a "processDependency" function, and if found the function will be invoked with each dependency in the order of the dependencies Array.

Parameters
dependencies:Array — Array of Objects

See also

processDependency
loadPanorama()method 
public function loadPanorama(params:Params):void

Loads a new panorama. This operation is asynchronous. The new panorama does not exist until PanoSalado dispatches a COMPLETE event, at which time, all the properties of the Params arg will be copied the the superclass ViewData. Any properties not specified in the Params object will be untouched. If you wish a panorama to open with pan, tilt, fieldOfView of 0,0,120 create a Params object with those values, and all other values will be inherited as they are. The only property of Params that must be set is the path.

Parameters
params:Params
processDependency()method 
public function processDependency(reference:Object, characteristics:*):void

Parameters
reference:Object — Object
 
characteristics:*
removeChild()method 
public override function removeChild(child:DisplayObject):DisplayObjectParameters
child:DisplayObject

Returns
DisplayObject
render()method 
public final function render(event:Event = null, viewData:ViewData = null):void

function that draws the panorama. Normally it is not necessary to call this function at all; normally the function is called to handle a RENDER event caused by setting a property on the ViewData instance with invalidates the stage. However, this function can be called WITHOUT an event arg, and WITH a viewData arg in order to predict and start loading images for the values in the viewData arg. Calling it with a null Event will not cause any drawing.

Parameters
event:Event (default = null) — Event non-null value will result in drawing using the superclass ViewData's properties
 
viewData:ViewData (default = null) — ViewData non-null value will result in using this ViewData's properties
renderAt()method 
public function renderAt(pan:Number, tilt:Number, fieldOfView:Number):void

Renders the panorama at the specified pan,tilt,fieldOfView. This is a convenience method for directly setting pan,tilt,fieldOfView. Any of the values will be untouched if NaN is passed. It also dispatches CameraEvent.ACTIVE and CameraEvent.INACTIVE before and after the changes to stop autorotation for the benefit of any listening objects (AutorotationCamera).

Parameters
pan:Number — Number (optional) pass NaN to use the current value
 
tilt:Number — Number (optional) pass NaN to use the current value
 
fieldOfView:Number — Number (optional) pass NaN to use the current value
setChildIndex()method 
public override function setChildIndex(child:DisplayObject, index:int):voidParameters
child:DisplayObject
 
index:int
startInertialSwing()method 
public function startInertialSwing(panSpeed:Number, tiltSpeed:Number, sensitivity:Number = 0.0003, friction:Number = 0.3, threshold:Number = 0.0001):void

Starts inertial motion (like the InertialMouseCamera) with the specified panSpeed, tiltSpeed using the specified sensitivity, friction, and threshold. For a panning motion (horizontal) pass a positive or negative non-zero (positive = right) panSpeed value. For tilt, pass a non-zero tiltSpeed value (positive = up). Calling stopInertialSwing() will zero out panSpeed and tiltSpeed, and slow the motion to a stop once the delta motion is under the threshold value. Subsequent calls to this function, but prior to calling stopInertialSwing() will modified the values but continue the motion. Calling stopInertialSwing() is identical in function to calling startInertialSwing(0,0). This function dispatches CameraEvent.ACTIVE and CameraEvent.INACTIVE before the motion starts and after it ceases, respectively.

Parameters
panSpeed:Number — Number (< 0 = left; > 0 right) the larger the absolute value, the faster the motion
 
tiltSpeed:Number — Number (< 0 = down; > 0 up) the larger the absolute value, the faster the motion
 
sensitivity:Number (default = 0.0003) — Number (optional) defaults to 0.0003
 
friction:Number (default = 0.3) — Number (optional) defaults to 0.3
 
threshold:Number (default = 0.0001) — Number (optional) defaults to 0.0001
stopInertialSwing()method 
public function stopInertialSwing():void

Stops the inertial motion caused by a call to startInertialSwing(). This is identical to calling startInertialSwing(0,0). Motion does not cease immediately; it slows until it is under the threshold specified in startInertialSwing().

swapChildren()method 
public override function swapChildren(child1:DisplayObject, child2:DisplayObject):voidParameters
child1:DisplayObject
 
child2:DisplayObject
swingTo()method 
public function swingTo(pan:Number, tilt:Number, fieldOfView:Number, time:Number = 2.5, tween:Function = null):void

Swings the camera to the specified pan,tilt,fieldOfView over the specified time (in seconds) using the specified tween function (with a standard Robert Penner tween function signature). NaN passed for pan, tilt, or fieldOfView will not changed the current value. It also dispatches CameraEvent.ACTIVE and CameraEvent.INACTIVE before and after the changes to stop autorotation for the benefit of any listening objects (AutorotationCamera).

Parameters
pan:Number — Number (optional) pass NaN to use the current value
 
tilt:Number — Number (optional) pass NaN to use the current value
 
fieldOfView:Number — Number (optional) pass NaN to use the current value
 
time:Number (default = 2.5) — Number (optional) defaults to 2.5 seconds
 
tween:Function (default = null) — Function (optional) defaults to Linear.easeNone. Function must have signature: function name (t:Number, b:Number, c:Number, d:Number):Number
swingToChild()method 
public function swingToChild(child:ManagedChild, fieldOfView:Number, time:Number = 2.5, tween:Function = null):void

Swings the camera to the specified ManagedChild, fieldOfView, over the specified time in seconds using the specified tween function (standard Robert Penner style signature). This function dispatches CameraEvent.ACTIVE and CameraEvent.INACTIVE before the motion starts and after it ceases, respectively.

Parameters
child:ManagedChild — ManagedChild
 
fieldOfView:Number — Number (optional) pass NaN to use the current value
 
time:Number (default = 2.5) — Number (optional) defaults to 2.5 seconds
 
tween:Function (default = null) — Function (optional) defaults to Linear.easeNone. Function must have signature: function name (t:Number, b:Number, c:Number, d:Number):Number
swingToChildComplete()method 
protected function swingToChildComplete(e:Event):voidParameters
e:Event
updateChildren()method 
protected final function updateChildren(container:Sprite, viewData:ViewData):void

Updates the position of all managedChildren of PanoSalado

Parameters
container:Sprite
 
viewData:ViewData

See also

managedChildren
Event detail
activeevent 
Event object type: com.panosalado.events.CameraEvent
CameraEvent.type property = com.panosalado.events.CameraEvent.ACTIVE

Dispatched before PanoSalado begins to change view properties as a result of API calls: loadPanorama, renderAt, swingTo, swingToChild, startInertialSwing/stopInertialSwing.

The CameraEvent.ACTIVE constant defines the value of the type property of the event object for an active event.

completeevent  
Event object type: flash.events.Event

Dispatched when a new panorama has loaded.

inactiveevent  
Event object type: com.panosalado.events.CameraEvent
CameraEvent.type property = com.panosalado.events.CameraEvent.INACTIVE

Dispatched after PanoSalado finishes changing view properties as a result of API calls: loadPanorama, renderAt, swingTo, swingToChild, startInertialSwing/stopInertialSwing. With

The CameraEvent.INACTIVE constant defines the value of the type property of the event object for an inactive event.

swingToChildCompleteevent  
Event object type: com.panosalado.events.PanoSaladoEvent
PanoSaladoEvent.type property = com.panosalado.events.PanoSaladoEvent.SWING_TO_CHILD_COMPLETE

Dispatched after a swingToChild is complete

The PanoSaladoEvent.SWING_TO_CHILD_COMPLETE constant defines the value of the type property of the event object for an swingToChildComplete event.

swingToCompleteevent  
Event object type: com.panosalado.events.PanoSaladoEvent
PanoSaladoEvent.type property = com.panosalado.events.PanoSaladoEvent.SWING_TO_COMPLETE

Dispatched after a swingTo is complete

The PanoSaladoEvent.SWING_TO_COMPLETE constant defines the value of the type property of the event object for an swingToComplete event.