Italiano:Pacchetto Modelli

TRANSLATION PENDING

Introduction
com.gaiaframework.templates The templates package consists of three classes used by Gaia's scaffolded page and preloader files.

AbstractBase
AbstractBase is the base class for both AbstractPage and AbstractPreloader, and implements the IBase interface. It contains the four Gaia transition methods.

Transition Methods
public function transitionIn:void {    dispatchEvent(new PageEvent(PageEvent.TRANSITION_IN)); } public function transitionOut:void {    dispatchEvent(new PageEvent(PageEvent.TRANSITION_OUT)); }

transitionIn and transitionOut dispatch an event that Gaia has told this page to transition in or out. These methods are usually overridden by your custom page classes, however, you can also choose listen to the events if you have nested clips inside your page that need to respond to them. If you override the methods and want to have nested clips still receive the event, make sure you call super(event) in your overrides.

Transition Complete Methods
public function transitionInComplete:void {    dispatchEvent(new PageEvent(PageEvent.TRANSITION_IN_COMPLETE)); } public function transitionOutComplete:void {    dispatchEvent(new PageEvent(PageEvent.TRANSITION_OUT_COMPLETE)); }

These two methods are used to communicate back to Gaia that the page is finished transitioning in or out. These methods are not usually overridden, however, you can if you have some cleanup to do when the page is finished transitioning out. If you do override them, you must call super.transitionInComplete or super.transitionOutComplete somewhere in your override. It is usually better to just handle your cleanup prior to calling the complete method and not override these methods.

AbstractPage
AbstractPage extends AbstractBase and is the class that all scaffolded pages in Gaia inherit from. It contains two implicit getters and setters, assets and page, as well as the onDeeplink event receiver. More information about these properties and the onDeeplink event can be found in the Pages documentation.

page
public function get page:IPageAsset {    return _page; } The page property returns a reference to the PageAsset class associated with this page. This is to give you access to PageAsset properties like branch, src, children, etc. More information about PageAsset properties can be found in the Pages and Site XML documentation.

assets
public function get assets:Object {    return _page.assets; } The assets property returns an object whose keys are the ids of the assets that belong to this page, and the values of those keys are the assets themselves. More information about individual assets can be found in the Assets documentation.

copy
public function get copy:Object {    return _page.copy; } The copy property returns an object whose keys are defined by the SEO p tags in the XHTML file. More information about this is found in the SEO documentation

onDeeplink
public function onDeeplink(event:GaiaSWFAddressEvent):void {    dispatchEvent(event); } The onDeeplink event receiver dispatches the event it receives by default. This method is almost always overridden with a custom onDeeplink handler. The event passed has a property "deeplink", and more information about this can be found in the Pages and Events Package documentation.

AbstractPreloader
AbstractPreloader extends AbstractBase and is the class the scaffolded Preloader inherits from. It contains only one method. If you make a custom preloader, you should extend this class or implement IPreloader in order for Gaia to be able to use it.

onProgress
public function onProgress(event:AssetEvent):void {    dispatchEvent(event); } The onProgress event dispatches the AssetEvent it receives. In the default scaffolded preloader, the PreloaderScaffold listens to this event. You can override this method if you do not use the PreloaderScaffold class and want to handle it directly in your own custom preloader. More information about the AssetEvent passed can be found in the Preloader and Events Package documentation.