Packageat.display
Classpublic class CallSwitcher
InheritanceCallSwitcher Inheritance mx.core.UIComponent

The CallSwitcher component transitions from one display to a different display via a 3-dimensional rotating cube.

A startSource and an endSource must be specified for this component to transition. The component takes a bitmap image of the startSource and then after the delayDuration and the dropBackDuration takes a bitmap image of the endSource. These delays should give enough time for the underlying visuals to change (i.e. change states) to make the transition effective. This component must not be a child of either component, otherwise it could be included in the bitmap capture.

The 3-dimensional cube can be rotated from top to bottom and from left to right and vice-versa. It can also be set to be random each time.

Once the startSource and endSource are supplied, the start() method must be called to start the transition.

The default width and height are 50 pixels each, respectively. This component works the best when it takes up the full size of the application.

The transition works best when the component is hidden initially, and hidden when the transition is complete. When taking up the whole screen, this component will blank out the screen with a bitmap of the startSource component. This allows for the visuals underneath to change. Then when the transition is complete, the component can be hidden for a seamless transition to the real content.



Public Properties
 PropertyDefined by
  delayDuration : int = 500
The duration of the delay in milliseconds to delay the transition.
CallSwitcher
  direction : String
The direction of the transition.
CallSwitcher
  dropBackDuration : int = 1000
The amount of time in milliseconds it takes for the startSource to drop back into space.
CallSwitcher
  dropIntoScreenDistance : int = 250
The distance on the z-axis that the startSource drops back.
CallSwitcher
  endSource : DisplayObject
The source component that will be rotated to on the 3D cube.
CallSwitcher
  isTransitioning : Boolean
[read-only] Set to true if the component is in the middle of a transition.
CallSwitcher
  randomDirection : Boolean = false
By setting this to true, the component will ignore the value set for the direction and selected one of the available directions.
CallSwitcher
  reflectionEnabled : Boolean
Determines whether (true) or not (false) the side of the cube have a reflection.
CallSwitcher
  rotateAndZoom : Boolean = false
Rotates and zooms the transition when set to true.
CallSwitcher
  startSource : DisplayObject
The source component that will be used on the face of the cube.
CallSwitcher
  transitionDuration : int = 1200
The amount of time it takes the startSource and endSource to transition after the intial delayDuration and dropBackDuration.
CallSwitcher
Protected Properties
 PropertyDefined by
  dropBackTween : Tween
The Tween that handles the dropping of the startSource into space.
CallSwitcher
  endTween : Tween
The Tween that handles the bringing to full-size of the endSource when rotateAndZoom is set to false.
CallSwitcher
  front : ImageStackHolder
The starting image holder.
CallSwitcher
  orientation : String = "horizontal"
Internal convenince variable to determine the direction of the spin.
CallSwitcher
  radius : Number = 0
Half the width or height of the component and varies based on direction.
CallSwitcher
  rotateEndTween : Tween
The Tween that handles the rotation of the endSource in 3D space.
CallSwitcher
  rotateStartTween : Tween
The Tween that handles the rotation of the startSource in 3D space.
CallSwitcher
  side : ImageStackHolder
The image holder to be transitioned to.
CallSwitcher
Public Methods
 MethodDefined by
  
Constructor.
CallSwitcher
  
sortChildren():void
Changes the indicies of all of the children of this component based on the z depth.
CallSwitcher
  
start():void
This method must be called to initate the cube transition.
CallSwitcher
  
transition(value:Object):void
Starts the rotation of the 3D cube, after the startSource has dropped back into space.
CallSwitcher
Protected Methods
 MethodDefined by
  
addedToStageHandler(e:Event):void
Handles the added to stage event.
CallSwitcher
  
cylindricalHelper(child:DisplayObject):void
Aids in setting the positions in space for the sides of the 3D cube.
CallSwitcher
  
endTransition(value:Object):void
Handles the end of the rotation if rotateAndZoom is false.
CallSwitcher
  
endTransitionDelayHandler(e:TimerEvent):void
Moves the endSource into place, taking up the size of the component.
CallSwitcher
  
endUpdateHandler(value:Object):void
Handles the endTween updates.
CallSwitcher
  
startTransition(e:TimerEvent):void
Starts the dropping back into space transition, after the intial delayDuration is finished.
CallSwitcher
  
startUpdateHandler(value:Object):void
Handles the updates of the dropBackTween as it drops into space.
CallSwitcher
  
transitionComplete(value:Object):void
Handles the end of the transition.
CallSwitcher
  
updateCompleteHandler(e:FlexEvent):void
Sets up the 3D projection when the component has finished loading.
CallSwitcher
  
updateEndHandler(value:Object):void
Handles the rotation of the endSource.
CallSwitcher
  
updateStartHandler(value:Object):void
Handles the rotation of the startSource.
CallSwitcher
Events
 EventSummaryDefined by
   Dispatched when the transition to the endSouce is complete.CallSwitcher
   Dispached when the startSource has dropped back into space.CallSwitcher
   Dispatched when the cube has dropped back and rotated to the endSource.CallSwitcher
   Dispatched when the transition has been initated with the start() method.CallSwitcher
Styles
 StyleDescriptionDefined by
  
backgroundAlpha
Type: Number
The alpha of the backgroundColor that will be displayed when the cube drops back into space. The default value is 1.
CallSwitcher
  
backgroundColor
Type: uint   Format: Color
The color of the background that is displayed when the cube drops back into space. The default value is #333333.
CallSwitcher
Public Constants
 ConstantDefined by
  COMPONENT_VERSION : String = "1.0.0"
[static] Component version.
CallSwitcher
Property detail
delayDurationproperty
public var delayDuration:int = 500

The duration of the delay in milliseconds to delay the transition.

Due to the fact that the component takes a capture of the startSource there can be a little processing delay, this helps hide capturing by waiting until the capture is complete to start the transition process.

The default value is 500.

directionproperty 
direction:String  [read-write]

The direction of the transition.

Possible values are top, right, bottom, and left. Setting this to one of these values will transition the sources in that direction. See the CallSwitcherDirections class for direction and value clarification.

The default value is "right".

Implementation
    public function get direction():String
    public function set direction(value:String):void

See also

dropBackDurationproperty 
public var dropBackDuration:int = 1000

The amount of time in milliseconds it takes for the startSource to drop back into space.

This duration is also applied to the time it takes to bring the endSource to the front when rotateAndZoom is set to false.

The default value is 1000.

dropBackTweenproperty 
protected var dropBackTween:Tween

The Tween that handles the dropping of the startSource into space.

dropIntoScreenDistanceproperty 
public var dropIntoScreenDistance:int = 250

The distance on the z-axis that the startSource drops back.

The default value is 250.

endSourceproperty 
public var endSource:DisplayObject

The source component that will be rotated to on the 3D cube.

Be sure that this component is not a child of the startSource or endSource or else it might display this component on a face of the rotation.

endTweenproperty 
protected var endTween:Tween

The Tween that handles the bringing to full-size of the endSource when rotateAndZoom is set to false.

frontproperty 
protected var front:ImageStackHolder

The starting image holder.

isTransitioningproperty 
isTransitioning:Boolean  [read-only]

Set to true if the component is in the middle of a transition.

The default value is false.

Implementation
    public function get isTransitioning():Boolean
orientationproperty 
protected var orientation:String = "horizontal"

Internal convenince variable to determine the direction of the spin.

The default value is "horizontal".

radiusproperty 
protected var radius:Number = 0

Half the width or height of the component and varies based on direction.

The default value is 0.

randomDirectionproperty 
public var randomDirection:Boolean = false

By setting this to true, the component will ignore the value set for the direction and selected one of the available directions.

The default value is false.

reflectionEnabledproperty 
reflectionEnabled:Boolean  [read-write]

Determines whether (true) or not (false) the side of the cube have a reflection.

The default value is false.

Implementation
    public function get reflectionEnabled():Boolean
    public function set reflectionEnabled(value:Boolean):void
rotateAndZoomproperty 
public var rotateAndZoom:Boolean = false

Rotates and zooms the transition when set to true.

The default value is false. When set to false the startSource will drop back in depth based on the dropIntoScreenDistance after the delayDuration. The animation will rotate, then after that, zoom back to the full size.

When set to true the last step will be combine and the animation will rotate and zoom back to the full size. This setting has a shorter duration.

The default value is false.

rotateEndTweenproperty 
protected var rotateEndTween:Tween

The Tween that handles the rotation of the endSource in 3D space.

rotateStartTweenproperty 
protected var rotateStartTween:Tween

The Tween that handles the rotation of the startSource in 3D space.

sideproperty 
protected var side:ImageStackHolder

The image holder to be transitioned to.

startSourceproperty 
public var startSource:DisplayObject

The source component that will be used on the face of the cube.

This will be rotated out of view to the endSource.

Be sure that this component is not a child of the startSource or endSource or else it might display this component on a face of the rotation.

transitionDurationproperty 
public var transitionDuration:int = 1200

The amount of time it takes the startSource and endSource to transition after the intial delayDuration and dropBackDuration.

The default value is 1200.

Constructor detail
CallSwitcher()constructor
public function CallSwitcher()

Constructor.

Method detail
addedToStageHandler()method
protected function addedToStageHandler(e:Event):void

Handles the added to stage event.

Parameters
e:Event — The event
cylindricalHelper()method 
protected function cylindricalHelper(child:DisplayObject):void

Aids in setting the positions in space for the sides of the 3D cube.

Parameters
child:DisplayObject — The side to set the coordinates for depending on direction
endTransition()method 
protected function endTransition(value:Object):void

Handles the end of the rotation if rotateAndZoom is false.

This sets a timer to delay the movement of the endSource to size to the size of the component.

Parameters
value:Object — The Tween result
endTransitionDelayHandler()method 
protected function endTransitionDelayHandler(e:TimerEvent):void

Moves the endSource into place, taking up the size of the component.

This movement is the reverse of how the startSource drops back into space.

Parameters
e:TimerEvent — The TimerEvent
endUpdateHandler()method 
protected function endUpdateHandler(value:Object):void

Handles the endTween updates.

Parameters
value:Object — The result from the endTween
sortChildren()method 
public function sortChildren():void

Changes the indicies of all of the children of this component based on the z depth.

start()method 
public function start():void

This method must be called to initate the cube transition.

Errors will be thrown if the startSource and endSource are not set.

startTransition()method 
protected function startTransition(e:TimerEvent):void

Starts the dropping back into space transition, after the intial delayDuration is finished.

Parameters
e:TimerEvent — The TimerEvent.TIMER_COMPLETE event
startUpdateHandler()method 
protected function startUpdateHandler(value:Object):void

Handles the updates of the dropBackTween as it drops into space.

Parameters
value:Object — Response from the rotateStartTween
transition()method 
public function transition(value:Object):void

Starts the rotation of the 3D cube, after the startSource has dropped back into space.

Parameters
value:Object — Response from the dropBackTween
transitionComplete()method 
protected function transitionComplete(value:Object):void

Handles the end of the transition.

Parameters
value:Object — The result from the endTween if rotateAndZoom is false.

Otherwise it is from the rotateEndTween if rotateAndZoom is true.

updateCompleteHandler()method 
protected function updateCompleteHandler(e:FlexEvent):void

Sets up the 3D projection when the component has finished loading.

Parameters
e:FlexEvent — The updateComplete event.

See also

flash.geom.PerspectiveProjection
updateEndHandler()method 
protected function updateEndHandler(value:Object):void

Handles the rotation of the endSource.

Parameters
value:Object — Response from the rotateEndTween
updateStartHandler()method 
protected function updateStartHandler(value:Object):void

Handles the rotation of the startSource.

Parameters
value:Object — Response from the rotateStartTween
Event detail
transitionCompleteevent 
Event object type: flash.events.Event

Dispatched when the transition to the endSouce is complete.

transitionDroppedBackevent  
Event object type: flash.events.Event

Dispached when the startSource has dropped back into space.

transitionRotatedevent  
Event object type: flash.events.Event

Dispatched when the cube has dropped back and rotated to the endSource.

transitionStartedevent  
Event object type: flash.events.Event

Dispatched when the transition has been initated with the start() method.

Constant detail
COMPONENT_VERSIONconstant
public static const COMPONENT_VERSION:String = "1.0.0"

Component version.