Packagecom.soma.interfaces
Interfacepublic interface IPage
ImplementorsPage, PageExternal

Author: Romuald Quantin - www.soundstep.com

Information:
Blog page - SomaUI
How does it work - Soma Protest
Project Host - Google Code
Documentation - Soma ASDOC
Class version: 2.0
Actionscript version: 3.0

Copyright:

The contents of this file are subject to the Mozilla Public License
Version 1.1 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.mozilla.org/MPL/

Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied.
See the License for the specific language governing rights and
limitations under the License.

The Original Code is Soma.
The Initial Developer of the Original Code is Romuald Quantin.
Initial Developer are Copyright (C) 2008-2009 Soundstep. All Rights Reserved.

Usage:
A page class that will be used by the PageManager instance must extend com.soma.view.Page and implements IPage. IPage describes the entry point (transitionIn) and exit point (transitionOutComplete) in a page class.

Page display process 1. When the PageManager instantiates a page, it commands the page to be displayed calling the transitionIn method (a PageEvent.TRANSITION_IN is dispatched by the super class), in this method you can display the page elements the way you wish. 2. When the page is fully displayed (display process: transition in), you must call the transitionInComplete and call the super class super.transitionInComplete() to end the display process, a PageEvent.TRANSITION_IN_COMPLETE is dispatched by the super class.

Page removing process 1. When a page is about to be removed, the PageManager will let you the time to do so by calling first a transitionOut method (a PageEvent.TRANSITION_OUT is dispatched by the super class), in this method you can hide and remove the page elements the way you wish. It is also a good place to destroy and remove instances and event listeners. 2. When the elements are hidden or removed (remove process: transition out), you must call the transitionOutComplete and call the super class super.transitionOutComplete() to end the display process and allow the PageManager to display the next page (especially important is you're using pages with depths). A PageEvent.TRANSITION_OUT_COMPLETE is dispatched by the super class.

Note: The proper way to initialize elements in a page is adding a listener PageEvent.INITIALIZED to the page class and build the elements in the Event handler. Here is a simple example to hide and show a page with a tween library:

override public function transitionIn():void {
    Tweener.addTween(this, {time:1, alpha:1, onComplete:transitionInComplete});
}

override public function transitionInComplete():void {
    super.transitionInComplete();
}

override public function transitionOut():void {
    Tweener.addTween(this, {time:1, alpha:0, onComplete:transitionOutComplete});
}
  
override public function transitionOutComplete():void {
    super.transitionOutComplete();
}
     

See also

com.soma.model.PageManager
com.soma.view.Page
com.soma.events.PageEvent


Public Methods
 MethodDefined by
  
transitionIn():void
Called by the PageManager to display a page instantiated.
IPage
  
Must be used to call the super.transitionInComplete() method and finish the display process.
IPage
  
Called by the PageManager to remove a page.
IPage
  
Must be used to call the super.transitionOutComplete() method and finish the removing process.
IPage
Method detail
transitionIn()method
public function transitionIn():void

Called by the PageManager to display a page instantiated.

transitionInComplete()method 
public function transitionInComplete():void

Must be used to call the super.transitionInComplete() method and finish the display process.

transitionOut()method 
public function transitionOut():void

Called by the PageManager to remove a page.

transitionOutComplete()method 
public function transitionOutComplete():void

Must be used to call the super.transitionOutComplete() method and finish the removing process.