Packagecom.soma.events
Classpublic class PageEvent
InheritancePageEvent Inheritance CairngormEvent Inheritance flash.events.Event

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:
Framework events dispatched through a single dispatcher related to the MenuManager (Soma.getInstance().menu).

The type SHOW and SHOW_EXTERNAL_LINK are commands:

new PageEvent(PageEvent.SHOW, "myPageID").dispatch();
new PageEvent(PageEvent.SHOW_EXTERNAL_LINK, null, "http://www.soundstep.com/").dispatch();
new PageEvent(PageEvent.SHOW_EXTERNAL_LINK, myPage.@id, myPage.@externalLink).dispatch();
     

The following types are not commands and the listeners can be added on the Soma class:

Soma.getInstance().addEventListener(PageEvent.STARTED, eventHandler);
Soma.getInstance().addEventListener(PageEvent.TRANSITION_IN, eventHandler);
Soma.getInstance().addEventListener(PageEvent.TRANSITION_IN_COMPLETE, eventHandler);
Soma.getInstance().addEventListener(PageEvent.TRANSITION_OUT, eventHandler);
Soma.getInstance().addEventListener(PageEvent.TRANSITION_OUT_COMPLETE, eventHandler);
Soma.getInstance().addEventListener(PageEvent.EXCLUDED, eventHandler);
Soma.getInstance().addEventListener(PageEvent.EXCLUDED_PARENT, eventHandler);
     

The following types are not commands and are not dispatched by Soma.
The listeners must be added in a Page instance.

this.addEventListener(PageEvent.INITIALIZED, eventHandler);
this.addEventListener(PageEvent.CONTENT_PARSED, eventHandler);
this.addEventListener(PageEvent.CONTENT_LOADED, eventHandler);
     

See also

Soma
PageManager
PageCommand
NodeParser


Public Properties
 PropertyDefined by
 Inheriteddata : *
The data property can be used to hold information to be passed with the event in cases where the developer does not want to extend the CairngormEvent class.
CairngormEvent
  externalLink : String
Value of the link that will be open in a new browser window.
PageEvent
  id : String
id of the page (attribute id in a page node of the XML Site Definition).
PageEvent
Public Methods
 MethodDefined by
  
PageEvent(type:String, id:String = "", externalLink:String = "", bubbles:Boolean = true, cancelable:Boolean = false)
Creates a PageEvent instance, the event can dispatch itself using the method dispatch (command).
PageEvent
  
clone():Event
Duplicates an instance of an Event subclass.

Returns a new Event object that is a copy of the original instance of the Event object.
PageEvent
  
dispatch():Boolean
Dispatch this event via the Cairngorm event dispatcher.
PageEvent
  
toString():String
Returns a formatted string to display event information.
PageEvent
Public Constants
 ConstantDefined by
  CONTENT_COMPLETE : String = "com.soma.events.PageEvent.CONTENT_COMPLETE"
[static] Indicates when the assets (in the content node of the page) have been loaded (assets instantiation and assets loading fully finished).
PageEvent
  CONTENT_PARSED : String = "com.soma.events.PageEvent.CONTENT_PARSED"
[static] Indicates when the assets (in the content node of the page) have been parsed (assets that don't need to be loaded are ready).
PageEvent
  EXCLUDED : String = "com.soma.events.PageEvent.EXCLUDED"
[static] Indicates when an excluded page has been called.

See Soma Protest Page Excluded section.

Soma.getInstance().addEventListener(PageEvent.EXCLUDED, eventHandler);
PageEvent
  EXCLUDED_PARENT : String = "com.soma.events.PageEvent.EXCLUDED_PARENT"
[static] Indicates when a page that contains excluded page children has been called.
PageEvent
  INITIALIZED : String = "com.soma.events.PageEvent.INITIALIZED"
[static] Indicates when a page bas been initialized (page added to stage and variables initialized).
PageEvent
  SHOW : String = "com.soma.events.PageEvent.SHOW"
[static] Soma command to display a page using the id from the XML Site Definition, use from anywhere in the code.

The parameter should the ID of the page (id attribute in the XML Site Definition)

new PageEvent(PageEvent.SHOW, "myPageID").dispatch();
PageEvent
  SHOW_EXTERNAL_LINK : String = "com.soma.events.PageEvent.SHOW_EXTERNAL_LINK"
[static] Soma command to open a new browser window in case the page in the XML Site Definition is an external link, example:

<page id="soundstep" externalLink="http://www.soundstep.com/">
<title><![CDATA[Soundstep]]></title>
</page>

This event can be automatically dispatched by the Singleton MenuContext (right-click menu).
Can also be used as a command from anywhere in the code:

new PageEvent(PageEvent.SHOW_EXTERNAL_LINK, null, "http://www.soundstep.com/").dispatch();
new PageEvent(PageEvent.SHOW_EXTERNAL_LINK, myPage.@id, myPage.@externalLink).dispatch();
PageEvent
  STARTED : String = "com.soma.events.PageEvent.STARTED"
[static] Indicates when a page is about to be instantiated by the PageManager instance (Soma.getInstance().page).

This event can be default prevented to stop the page manager to display and hide pages.

Soma.getInstance().addEventListener(PageEvent.STARTED, eventHandler);
PageEvent
  TRANSITION_IN : String = "com.soma.events.PageEvent.TRANSITION_IN"
[static] Indicates when a page has been instantiated and is about to be displayed.

Soma.getInstance().addEventListener(PageEvent.TRANSITION_IN, eventHandler);
PageEvent
  TRANSITION_IN_COMPLETE : String = "com.soma.events.PageEvent.TRANSITION_IN_COMPLETE"
[static] Indicates when a page has been displayed.

Soma.getInstance().addEventListener(PageEvent.TRANSITION_IN_COMPLETE, eventHandler);
PageEvent
  TRANSITION_OUT : String = "com.soma.events.PageEvent.TRANSITION_OUT"
[static] Indicates when a page is about to be hidden.

Soma.getInstance().addEventListener(PageEvent.TRANSITION_OUT, eventHandler);
PageEvent
  TRANSITION_OUT_COMPLETE : String = "com.soma.events.PageEvent.TRANSITION_OUT_COMPLETE"
[static] Indicates when a page has been hidden.

Soma.getInstance().addEventListener(PageEvent.TRANSITION_OUT_COMPLETE, eventHandler);
PageEvent
Property detail
externalLinkproperty
public var externalLink:String

Value of the link that will be open in a new browser window.

idproperty 
public var id:String

id of the page (attribute id in a page node of the XML Site Definition). The id is also the Page name in the container of the pages (Soma.getInstance().page.container).

Constructor detail
PageEvent()constructor
public function PageEvent(type:String, id:String = "", externalLink:String = "", bubbles:Boolean = true, cancelable:Boolean = false)

Creates a PageEvent instance, the event can dispatch itself using the method dispatch (command).

Parameters
type:String — The type of the event, accessible as PageEvent.type.
 
id:String (default = "") — The id of the background.
 
externalLink:String (default = "") — The value of the link that will be open in a new browser window.
 
bubbles:Boolean (default = true) — Determines whether the Event object participates in the bubbling stage of the event flow. The default value is false.
 
cancelable:Boolean (default = false) — Determines whether the Event object can be canceled. The default values is false.
Method detail
clone()method
public override function clone():Event

Duplicates an instance of an Event subclass.

Returns a new Event object that is a copy of the original instance of the Event object. You do not normally call clone(); the EventDispatcher class calls it automatically when you redispatch an event—that is, when you call dispatchEvent(event) from a handler that is handling event.

The new Event object includes all the properties of the original.

Returns
Event — A new Event object that is identical to the original.
dispatch()method 
public override function dispatch():Boolean

Dispatch this event via the Cairngorm event dispatcher.

Returns
Boolean
toString()method 
public override function toString():String

Returns a formatted string to display event information.

Returns
String — A String.
Constant detail
CONTENT_COMPLETEconstant
public static const CONTENT_COMPLETE:String = "com.soma.events.PageEvent.CONTENT_COMPLETE"

Indicates when the assets (in the content node of the page) have been loaded (assets instantiation and assets loading fully finished). this.addEventListener(PageEvent.CONTENT_PARSED, eventHandler);

CONTENT_PARSEDconstant 
public static const CONTENT_PARSED:String = "com.soma.events.PageEvent.CONTENT_PARSED"

Indicates when the assets (in the content node of the page) have been parsed (assets that don't need to be loaded are ready). this.addEventListener(PageEvent.CONTENT_PARSED, eventHandler);

EXCLUDEDconstant 
public static const EXCLUDED:String = "com.soma.events.PageEvent.EXCLUDED"

Indicates when an excluded page has been called.

See Soma Protest Page Excluded section.

Soma.getInstance().addEventListener(PageEvent.EXCLUDED, eventHandler);

EXCLUDED_PARENTconstant 
public static const EXCLUDED_PARENT:String = "com.soma.events.PageEvent.EXCLUDED_PARENT"

Indicates when a page that contains excluded page children has been called. See Soma Protest Page Excluded section.
Soma.getInstance().addEventListener(PageEvent.EXCLUDED_PARENT, eventHandler);

INITIALIZEDconstant 
public static const INITIALIZED:String = "com.soma.events.PageEvent.INITIALIZED"

Indicates when a page bas been initialized (page added to stage and variables initialized). See Soma Protest Page Excluded section.
this.addEventListener(PageEvent.INITIALIZED, eventHandler);

SHOWconstant 
public static const SHOW:String = "com.soma.events.PageEvent.SHOW"

Soma command to display a page using the id from the XML Site Definition, use from anywhere in the code.

The parameter should the ID of the page (id attribute in the XML Site Definition)

new PageEvent(PageEvent.SHOW, "myPageID").dispatch();

SHOW_EXTERNAL_LINKconstant 
public static const SHOW_EXTERNAL_LINK:String = "com.soma.events.PageEvent.SHOW_EXTERNAL_LINK"

Soma command to open a new browser window in case the page in the XML Site Definition is an external link, example:

<page id="soundstep" externalLink="http://www.soundstep.com/">
<title><![CDATA[Soundstep]]></title>
</page>

This event can be automatically dispatched by the Singleton MenuContext (right-click menu).
Can also be used as a command from anywhere in the code:

new PageEvent(PageEvent.SHOW_EXTERNAL_LINK, null, "http://www.soundstep.com/").dispatch();
new PageEvent(PageEvent.SHOW_EXTERNAL_LINK, myPage.@id, myPage.@externalLink).dispatch();

STARTEDconstant 
public static const STARTED:String = "com.soma.events.PageEvent.STARTED"

Indicates when a page is about to be instantiated by the PageManager instance (Soma.getInstance().page).

This event can be default prevented to stop the page manager to display and hide pages.

Soma.getInstance().addEventListener(PageEvent.STARTED, eventHandler);

TRANSITION_INconstant 
public static const TRANSITION_IN:String = "com.soma.events.PageEvent.TRANSITION_IN"

Indicates when a page has been instantiated and is about to be displayed.

Soma.getInstance().addEventListener(PageEvent.TRANSITION_IN, eventHandler);

TRANSITION_IN_COMPLETEconstant 
public static const TRANSITION_IN_COMPLETE:String = "com.soma.events.PageEvent.TRANSITION_IN_COMPLETE"

Indicates when a page has been displayed.

Soma.getInstance().addEventListener(PageEvent.TRANSITION_IN_COMPLETE, eventHandler);

TRANSITION_OUTconstant 
public static const TRANSITION_OUT:String = "com.soma.events.PageEvent.TRANSITION_OUT"

Indicates when a page is about to be hidden.

Soma.getInstance().addEventListener(PageEvent.TRANSITION_OUT, eventHandler);

TRANSITION_OUT_COMPLETEconstant 
public static const TRANSITION_OUT_COMPLETE:String = "com.soma.events.PageEvent.TRANSITION_OUT_COMPLETE"

Indicates when a page has been hidden.

Soma.getInstance().addEventListener(PageEvent.TRANSITION_OUT_COMPLETE, eventHandler);