Packagesekati.ui
Classpublic class Viewport
InheritanceViewport Inheritance flash.events.EventDispatcher

Viewport provides a faux application viewport via a set of letterboxing DisplayObject's to confine content. By default these are set at a 16:9 proportion and maintain the proportion to Canvas.stage. A ViewportEvent.RENDER is dispatched when the Viewport is updated. This condenses StageDisplay events and assists in liquid layouts which require a proportional relationship within a Viewport.


Example
  // Note: Document class extends sekati.display.Canvas
  // initialize the StageDisplay
  StageDisplay.$.init( );
  // initialize a viewport with a 25 pixel minimum footer.
  Viewport.$.init( this, 25 );
  Viewport.$.render( );
  

See also

sekati.events.ViewportEvent
sekati.display.StageDisplay


Public Properties
 PropertyDefined by
  $ : Viewport
[static][read-only] Shorthand singleton accessor getter
Viewport
  bottom : int
[read-only] Return bottom of the visible viewport.
Viewport
  bottomBox : Shape
[read-only] Return the bottom letterbox shape.
Viewport
  centerx : int
[read-only] Return viewport center x position.
Viewport
  centery : int
[read-only] Return viewport center y position.
Viewport
  height : int
[read-only] Return viewport height.
Viewport
  proportionHeight : uint
[read-only] Return ratio proportional height.
Viewport
  proportionWidth : uint
[read-only] Return ratio proportional width.
Viewport
  ratio : Number
[read-only] Return viewport ratio.
Viewport
  top : int
[read-only] Return top of the visible viewport.
Viewport
  topBox : Shape
[read-only] Return the top letter box shape.
Viewport
  viewport : Shape
[read-only] Return the viewport shape.
Viewport
  width : int
[read-only] Return viewport width.
Viewport
  x : int
[read-only] Return viewport x position.
Viewport
  y : int
[read-only] Return viewport y position.
Viewport
Protected Properties
 PropertyDefined by
  _bb : Shape
Viewport
  BOTTOM_CONSTRAINT : uint
Viewport
  _instance : Viewport
[static]
Viewport
  PROPORTION_HEIGHT : uint
Viewport
  PROPORTION_WIDTH : uint
Viewport
  RATIO : Number
Viewport
  _target : DisplayObjectContainer
Viewport
  _tb : Shape
Viewport
  _vp : Shape
Viewport
Public Methods
 MethodDefined by
  
Viewport($:SingletonEnforcer = null)
Viewport Singleton Constructor
Viewport
  
destroy():void
Destroy the Viewport
Viewport
  
[static] Singleton Accessor
Viewport
  
init(target:DisplayObjectContainer, bottomConstraint:uint = 0, proportionWidth:uint = 16, proportionHeight:uint = 9, lbColor:int = 0x000000, vpColor:uint = 0xFFFFFF, lbVisible:Boolean = true, vpVisible:Boolean = false):void
Parameterized Viewport initialization.
Viewport
  
render(e:StageEvent = null):void
Update the Viewport confines and dispatch ViewportEvent.RENDER.
Viewport
Property detail
$property
$:Viewport  [read-only]

Shorthand singleton accessor getter

Implementation
    public static function get $():Viewport
_bbproperty 
protected var _bb:Shape
bottomproperty 
bottom:int  [read-only]

Return bottom of the visible viewport.

Implementation
    public function get bottom():int
bottomBoxproperty 
bottomBox:Shape  [read-only]

Return the bottom letterbox shape.

Implementation
    public function get bottomBox():Shape
BOTTOM_CONSTRAINTproperty 
protected var BOTTOM_CONSTRAINT:uint
centerxproperty 
centerx:int  [read-only]

Return viewport center x position.

Implementation
    public function get centerx():int
centeryproperty 
centery:int  [read-only]

Return viewport center y position.

Implementation
    public function get centery():int
heightproperty 
height:int  [read-only]

Return viewport height.

Implementation
    public function get height():int
_instanceproperty 
protected static var _instance:Viewport
proportionHeightproperty 
proportionHeight:uint  [read-only]

Return ratio proportional height.

Implementation
    public function get proportionHeight():uint
PROPORTION_HEIGHTproperty 
protected var PROPORTION_HEIGHT:uint
proportionWidthproperty 
proportionWidth:uint  [read-only]

Return ratio proportional width.

Implementation
    public function get proportionWidth():uint
PROPORTION_WIDTHproperty 
protected var PROPORTION_WIDTH:uint
ratioproperty 
ratio:Number  [read-only]

Return viewport ratio.

Implementation
    public function get ratio():Number
RATIOproperty 
protected var RATIO:Number
_targetproperty 
protected var _target:DisplayObjectContainer
_tbproperty 
protected var _tb:Shape
topproperty 
top:int  [read-only]

Return top of the visible viewport.

Implementation
    public function get top():int
topBoxproperty 
topBox:Shape  [read-only]

Return the top letter box shape.

Implementation
    public function get topBox():Shape
viewportproperty 
viewport:Shape  [read-only]

Return the viewport shape.

Implementation
    public function get viewport():Shape
_vpproperty 
protected var _vp:Shape
widthproperty 
width:int  [read-only]

Return viewport width.

Implementation
    public function get width():int
xproperty 
x:int  [read-only]

Return viewport x position.

Implementation
    public function get x():int
yproperty 
y:int  [read-only]

Return viewport y position.

Implementation
    public function get y():int
Constructor detail
Viewport()constructor
public function Viewport($:SingletonEnforcer = null)

Viewport Singleton Constructor

Parameters
$:SingletonEnforcer (default = null) — SingletonEnforcer - internal to the AS file; the param prevents external instantiation without error.
Method detail
destroy()method
public function destroy():void

Destroy the Viewport

getInstance()method 
public static function getInstance():Viewport

Singleton Accessor

Returns
Viewport — Viewport
init()method 
public function init(target:DisplayObjectContainer, bottomConstraint:uint = 0, proportionWidth:uint = 16, proportionHeight:uint = 9, lbColor:int = 0x000000, vpColor:uint = 0xFFFFFF, lbVisible:Boolean = true, vpVisible:Boolean = false):void

Parameterized Viewport initialization.

Parameters
target:DisplayObjectContainer — target viewport container object.
 
bottomConstraint:uint (default = 0) — defines the minimum bottom letter-box height.
 
proportionWidth:uint (default = 16) — proportional width of the viewport.
 
proportionHeight:uint (default = 9) — proportional height of the viewport.
 
lbColor:int (default = 0x000000) — letter-box color.
 
vpColor:uint (default = 0xFFFFFF) — viewport color.
 
lbVisible:Boolean (default = true) — display the letterbox DisplayObjects.
 
vpVisible:Boolean (default = false) — display the viewport DisplayObject.
render()method 
public function render(e:StageEvent = null):void

Update the Viewport confines and dispatch ViewportEvent.RENDER.

Note: This is not a true "render" but as it is generally related to liquid-layout scenarios in which the layout is "re-rendered" the name is semi-appropriate.

Parameters
e:StageEvent (default = null)