Packagecom.soma
Classpublic class Soma
ImplementsIModelLocator

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.1
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:
The Soma Singleton (extendable) is the entry point to access to the framework.


Example
Soma.getInstance().addEventListener(SomaEvent.INITIALIZED, initialized);
Soma.getInstance().addEventListener(ContentEvent.LOADED, contentLoaded);
Soma.getInstance().registerGloBalStyleSheet("css/styles.css");
Soma.getInstance().start(this, "data/site.xml", new Config());

private function contentLoaded(e:ContentEvent = null):void {
    // xml and stylesheet have been loaded (components that don't require the XML Site Definition are initialized)
    trace(Soma.getInstance().container);
    trace(Soma.getInstance().content.data.toXMLString());
}

private function initialized(e:SomaEvent = null):void {
    // Soma is initialized
    trace(Soma.getInstance().page.currentPage);
}
     



Public Properties
 PropertyDefined by
  background : BackgroundManager
[read-only] Get the background manager (containing the background container and the backgrounds).
Soma
  base : BaseManager
[read-only] Get the base manager library.
Soma
  baseUI : BaseUI
[read-only] Get the global BaseUI instance (used for loading class if centered and the layout if set to fixed).
Soma
  classImport : ClassImport
[read-only] Return the global ClassImport instance (use Soma.getInstance().registerClass and Soma.getInstance().getClass).
Soma
  config : IConfig
[read-only] Get the config file.
Soma
  container : Sprite
[read-only] Get the main container of the site (contains pages, menu and loading);
Soma
  content : ContentManager
[read-only] Get the content manager (containing the XML Site Definition).
Soma
  currentLanguage : String
Current language String (example: "en") set using Soma.getInstance().initLanguage(true, "en");
Soma
  GLOBAL_LOADING_CENTERED : Boolean
[static] static global value whether or not the user loading display (super class: com.soma.view.Loading, interface: com.soma.loader.ILoading) of the main global loader (Soma.getInstance().loader) will be centered in the layout (default true).
Soma
  initialized : Boolean
[read-only] Whether or not Soma is initialized.
Soma
  languageEnabled : Boolean
Whether or not the language is enabled.
Soma
  library : ILibrary
[read-only] Get the global library.
Soma
  loader : SomaLoader
[read-only] Get the global loader (used to load the stylesheet, the XML Site Definition and the assets in the pages).
Soma
  menu : MenuManager
[read-only] Get the menu manager (containing the global menu if used).
Soma
  page : PageManager
[read-only] Get the page manager (containing the page container and the pages).
Soma
  referenceBaseUI : DisplayObjectContainer
[read-only] Get the reference of the global BaseUI instance, the reference is the main container if the layout is set to fixed or the stage if the layout is set to liquid.
Soma
  styles : StyleManager
[read-only] Get the style manager (containing stylesheets loaded).
Soma
  ui : DisplayObjectContainer
[read-only] Get the main document class registered when Soma starts, usually Sprite or MovieClip.
Soma
Public Methods
 MethodDefined by
  
Soma()
Soma is an extendable Singleton, use Soma.getInstance().
Soma
  
addEventListener(p_type:String, p_listener:Function, p_useCapture:Boolean = false, p_priority:int = 0, p_useWeakReference:Boolean = false):void
Soma
  
dispatchEvent(p_event:CairngormEvent):Boolean
Soma
  
getClass(className:String):Class
Get a Class registered using the method Soma.getInstance().registerClass.
Soma
  
[static] Soma is an extendable Singleton, getInstance() is returning the Soma instance to access to the framework and its components.
Soma
  
getModel(model:String):*
Get a model instance from Soma (managers).
Soma
  
hasEventListener(type:String):Boolean
Soma
  
initLanguage(languageEnabled:Boolean, language:String = ""):void
Initialize a String language (the current language when Soma starts) to be used in the deep-linking URL with SWFAddress.
It must be used before starting Soma and it will prepend the value before the URL, example: mysite.com/#/home will become mysite.com/#/en/home.
The value can be changed at run-time using Soma.getInstance().currentLanguage and will dispatch a SomaEvent.LANGUAGE_CHANGED event through the framework.
Soma
  
registerClass(value:Class):String
Register a Class with the ClassImport instance to force its import by the compiler (useful with getDefinitionByName).
Soma
  
registerGloBalStyleSheet(url:String):void
Register the URL of a global stylesheet (css) to load at the initialization process.
Soma
  
removeEventListener(p_type:String, p_listener:Function, p_useCapture:Boolean = false):void
Soma
  
start(ui:DisplayObjectContainer, xmlFile:String, config:IConfig):void
Starts the Soma framework.
Soma
  
startWithXML(ui:DisplayObjectContainer, xml:XML, config:IConfig):void
Starts the Soma framework with an XML already loaded.
Soma
  
willTrigger(type:String):Boolean
Soma
Events
 EventSummaryDefined by
   Indicates when an excluded page has been called.

See Soma Protest Page Excluded section.
Soma.getInstance().addEventListener(PageEvent.EXCLUDED, eventHandler);
Soma
   Indicates when a page that contains excluded page children has been called.Soma
   Soma command to display a background using the id from the XML Site Definition, use from anywhere in the code:

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

new BackgroundEvent(BackgroundEvent.HIDE, "myBackground").dispatch();
Soma
   Indicates when Soma has been initialized.

Soma.getInstance().addEventListener(SomaEvent.INITIALIZED, eventHandler);
Soma
   Indicates the language (string in the URL) has been changed.

Soma.getInstance().addEventListener(SomaEvent.LANGUAGE_CHANGED, eventHandler);
Soma
   Indicates when the XML Site Definition has been loaded.

Soma.getInstance().addEventListener(StyleSheetEvent.LOADED, eventHandler);
Soma
   Indicates when the XML Site Definition has been loaded.

Soma.getInstance().addEventListener(ContentEvent.LOADED, eventHandler);
Soma
   Soma command that will be received by the user's custom menu (IMenu) to update the state of this menu when a new page is about to be displayed.

This event is automatically dispatched by the PageManager instance in some case, such as a URL change (Soma.getInstance().page).

Can also be used as a command from anywhere in the code, the parameter should be the ID of the page (id attribute in the XML Site Definition):

new MenuEvent(MenuEvent.OPEN_MENU, "myID").dispatch();
Soma
   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();
Soma
   Soma command to display a background using the id from the XML Site Definition, use from anywhere in the code:

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

new BackgroundEvent(BackgroundEvent.SHOW, "myBackground").dispatch();
Soma
   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();
Soma
   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);
Soma
   Indicates when a page has been instantiated and is about to be displayed.

Soma.getInstance().addEventListener(PageEvent.TRANSITION_IN, eventHandler);
Soma
   Indicates when a background is about to be displayed by the BackgroundManager instance (Soma.getInstance().background).

Soma.getInstance().addEventListener(BackgroundEvent.TRANSITION_IN, eventHandler);
Soma
   Indicates when a page has been displayed.

Soma.getInstance().addEventListener(PageEvent.TRANSITION_IN_COMPLETE, eventHandler);
Soma
   Indicates when a page is about to be hidden.

Soma.getInstance().addEventListener(PageEvent.TRANSITION_OUT, eventHandler);
Soma
   Indicates when a background is about to be hidden by the BackgroundManager instance (Soma.getInstance().background).

Soma.getInstance().addEventListener(BackgroundEvent.TRANSITION_OUT, eventHandler);
Soma
   Indicates when a page has been hidden.

Soma.getInstance().addEventListener(PageEvent.TRANSITION_OUT_COMPLETE, eventHandler);
Soma
   Indicates when the XML Site Definition has been updated.

Soma.getInstance().addEventListener(ContentEvent.UPDATED, eventHandler);
Soma
Public Constants
 ConstantDefined by
  FIXED_LAYOUT : String = "fixed"
[static] Constant value used to defined that the layout of the site is a fixed user interface, the width and height are fixed values applied to the main container (Soma.getInstance().container).
Soma
  LIQUID_LAYOUT : String = "liquid"
[static] Constant value used to defined that the layout of the site is a liquid user interface, the width and height of the main container is updated to fit the browser (Soma.getInstance().container).
Soma
  MODEL_BACKGROUND : String = "com.soma.Soma.MODEL_BACKGROUND"
[static] Constant value used to get a specific model class (manager) with the method getModel, example: Soma.getInstance().getModel(Soma.MODEL_BACKGROUND) equivalent to Soma.getInstance().background
Soma
  MODEL_BASE : String = "com.soma.Soma.MODEL_BASE"
[static] Constant value used to get a specific model class (manager) with the method getModel, example: Soma.getInstance().getModel(Soma.MODEL_BASE) equivalent to Soma.getInstance().base
Soma
  MODEL_BASEUI : String = "com.soma.Soma.MODEL_BASEUI"
[static] Constant value used to get a specific model class (manager) with the method getModel, example: Soma.getInstance().getModel(Soma.MODEL_BASEUI) equivalent to Soma.getInstance().baseUI
Soma
  MODEL_CONFIG : String = "com.soma.Soma.MODEL_CONFIG"
[static] Constant value used to get a specific model class (manager) with the method getModel, example: Soma.getInstance().getModel(Soma.MODEL_CONFIG) equivalent to Soma.getInstance().config
Soma
  MODEL_CONTENT : String = "com.soma.Soma.MODEL_CONTENT"
[static] Constant value used to get a specific model class (manager) with the method getModel, example: Soma.getInstance().getModel(Soma.MODEL_CONTENT) equivalent to Soma.getInstance().content
Soma
  MODEL_LIBRARY : String = "com.soma.Soma.MODEL_LIBRARY"
[static] Constant value used to get a specific model class (manager) with the method getModel, example: Soma.getInstance().getModel(Soma.MODEL_LIBRARY) equivalent to Soma.getInstance().library
Soma
  MODEL_LOADER : String = "com.soma.Soma.MODEL_LOADER"
[static] Constant value used to get a specific model class (manager) with the method getModel example: Soma.getInstance().getModel(Soma.MODEL_LOADER) equivalent to Soma.getInstance().loader
Soma
  MODEL_MENU : String = "com.soma.Soma.MODEL_MENU"
[static] Constant value used to get a specific model class (manager) with the method getModel, example: Soma.getInstance().getModel(Soma.MODEL_MENU) equivalent to Soma.getInstance().menu
Soma
  MODEL_PAGE : String = "com.soma.Soma.MODEL_PAGE"
[static] Constant value used to get a specific model class (manager) with the method getModel, example: Soma.getInstance().getModel(Soma.MODEL_PAGE) equivalent to Soma.getInstance().page
Soma
  MODEL_STYLE : String = "com.soma.Soma.MODEL_STYLE"
[static] Constant value used to get a specific model class (manager) with the method getModel, example: Soma.getInstance().getModel(Soma.MODEL_STYLE) equivalent to Soma.getInstance().styles
Soma
  VERSION : String = "2.0.2"
[static] Constant value of the Soma Version.
Soma
Property detail
backgroundproperty
background:BackgroundManager  [read-only]

Get the background manager (containing the background container and the backgrounds).

Implementation
    public function get background():BackgroundManager

Example
   Soma.getInstance().background.container // access to container of the backgrounds
   Soma.getInstance().background.currentBackground // access to currently displayed background
   

baseproperty 
base:BaseManager  [read-only]

Get the base manager library. The Base is a Sprite layer between the backgrounds Sprite layer and the site container layer and is meant to easily add DisplayObject (even from the XML) that are always on the screen (such as a logo).

Implementation
    public function get base():BaseManager

Example
   Soma.getInstance().base.container; // access to the container of the Base layer
   Soma.getInstance().base.getElementByID("my asset") // access to a Base DisplayObject (instantiated from the XML or by code).
   

baseUIproperty 
baseUI:BaseUI  [read-only]

Get the global BaseUI instance (used for loading class if centered and the layout if set to fixed).

Implementation
    public function get baseUI():BaseUI
classImportproperty 
classImport:ClassImport  [read-only]

Return the global ClassImport instance (use Soma.getInstance().registerClass and Soma.getInstance().getClass).

Implementation
    public function get classImport():ClassImport
configproperty 
config:IConfig  [read-only]

Get the config file.

Implementation
    public function get config():IConfig

Example
   Soma.getInstance().config.siteName(); // access to the site name
   MyConfig(Soma.getInstance().config).myConfigMethod(); // access to a specific user method
   

containerproperty 
container:Sprite  [read-only]

Get the main container of the site (contains pages, menu and loading);

Implementation
    public function get container():Sprite
contentproperty 
content:ContentManager  [read-only]

Get the content manager (containing the XML Site Definition).

Implementation
    public function get content():ContentManager

Example
   Soma.getInstance().content.data // access to the XML Site Definition
   

currentLanguageproperty 
currentLanguage:String  [read-write]

Current language String (example: "en") set using Soma.getInstance().initLanguage(true, "en");

Implementation
    public function get currentLanguage():String
    public function set currentLanguage(value:String):void
GLOBAL_LOADING_CENTEREDproperty 
public static var GLOBAL_LOADING_CENTERED:Boolean

static global value whether or not the user loading display (super class: com.soma.view.Loading, interface: com.soma.loader.ILoading) of the main global loader (Soma.getInstance().loader) will be centered in the layout (default true). It must be changed before starting Soma, if the value is true, the loading display class will be added to the global baseUI instance (Soma.getInstance().baseUI).

initializedproperty 
initialized:Boolean  [read-only]

Whether or not Soma is initialized.

Implementation
    public function get initialized():Boolean
languageEnabledproperty 
languageEnabled:Boolean  [read-write]

Whether or not the language is enabled.

Implementation
    public function get languageEnabled():Boolean
    public function set languageEnabled(value:Boolean):void
libraryproperty 
library:ILibrary  [read-only]

Get the global library. It contains special assets registered by the framework such as SomaText, SomaVideo, ... and used by a NodeParser instance to dynamically instantiate assets from the XML Site Definition.

Implementation
    public function get library():ILibrary

Example
   Soma.getInstance().library.registerAsset("myAsset", "com.mypackage.MyAssetClass"); // register a custom asset class
   <myAsset id="myAssetID" x="10" y="10" /> // use of a registered custom asset in the XML Site Definition
   

loaderproperty 
loader:SomaLoader  [read-only]

Get the global loader (used to load the stylesheet, the XML Site Definition and the assets in the pages).

Implementation
    public function get loader():SomaLoader

Example
   var itemloaded:Dictionary = Soma.getInstance().loader.getLoadedItems(); // access to a list of items previously loaded
   Soma.getInstance().loader.add("image.jpg"); // add an image to load in the global loader
   Soma.getInstance().loader.start(); // start to load
   

menuproperty 
menu:MenuManager  [read-only]

Get the menu manager (containing the global menu if used).

Implementation
    public function get menu():MenuManager

Example
   Soma.getInstance().menu.getMenu(Soma.getInstance().config.menuClassName) // access to the global menu
   

pageproperty 
page:PageManager  [read-only]

Get the page manager (containing the page container and the pages).

Implementation
    public function get page():PageManager

Example
   Soma.getInstance().page.currentPage // access to the current page
   

referenceBaseUIproperty 
referenceBaseUI:DisplayObjectContainer  [read-only]

Get the reference of the global BaseUI instance, the reference is the main container if the layout is set to fixed or the stage if the layout is set to liquid.

Implementation
    public function get referenceBaseUI():DisplayObjectContainer
stylesproperty 
styles:StyleManager  [read-only]

Get the style manager (containing stylesheets loaded).

Implementation
    public function get styles():StyleManager

Example
   Soma.getInstance().style.loadStyleSheet("myStylesheet", "myNewStyleSheet.css"); // load a stylesheet
   Soma.getInstance().style.getStyleSheet("myStylesheet"); // get a stylesheet
   Soma.getInstance().style.getGlobalStyle("myStyle"); // get a style from the global stylesheet
   

uiproperty 
ui:DisplayObjectContainer  [read-only]

Get the main document class registered when Soma starts, usually Sprite or MovieClip. To access to your own Document class methods and property you can cast to your own class: MyMainClass(Soma.getInstance().ui).myMethod()

Implementation
    public function get ui():DisplayObjectContainer
Constructor detail
Soma()constructor
public function Soma()

Soma is an extendable Singleton, use Soma.getInstance(). See the Soma Protest source code for an example to extend Soma and alter the initializing/starting process.

Method detail
addEventListener()method
public function addEventListener(p_type:String, p_listener:Function, p_useCapture:Boolean = false, p_priority:int = 0, p_useWeakReference:Boolean = false):void

Parameters
p_type:String
 
p_listener:Function
 
p_useCapture:Boolean (default = false)
 
p_priority:int (default = 0)
 
p_useWeakReference:Boolean (default = false)
dispatchEvent()method 
public function dispatchEvent(p_event:CairngormEvent):Boolean

Parameters
p_event:CairngormEvent

Returns
Boolean
getClass()method 
public function getClass(className:String):Class

Get a Class registered using the method Soma.getInstance().registerClass.

   var MyClassType:Class = Soma.getInstance().getClass("MyClass");
   

Parameters
className:String — Class name (String) of a class to force its import by the compiler (useful with getDefinitionByName).

Returns
Class — A Class.
getInstance()method 
public static function getInstance():Soma

Soma is an extendable Singleton, getInstance() is returning the Soma instance to access to the framework and its components.

Returns
Soma — Soma instance
getModel()method 
public function getModel(model:String):*

Get a model instance from Soma (managers).

Parameters
model:String

Returns
* — the StyleManager instance.

Example
   // access to the background manager (equals to Soma.getInstance().background);
   var background:BackgroundManager = Soma.getInstance().getModel(Soma.MODEL_BACKGROUND) as BackgroundManager;
   

hasEventListener()method 
public function hasEventListener(type:String):Boolean

Parameters
type:String

Returns
Boolean
initLanguage()method 
public function initLanguage(languageEnabled:Boolean, language:String = ""):void

Initialize a String language (the current language when Soma starts) to be used in the deep-linking URL with SWFAddress.
It must be used before starting Soma and it will prepend the value before the URL, example: mysite.com/#/home will become mysite.com/#/en/home.
The value can be changed at run-time using Soma.getInstance().currentLanguage and will dispatch a SomaEvent.LANGUAGE_CHANGED event through the framework.

Parameters
languageEnabled:Boolean — Enable or Disable the language String in the URL.
 
language:String (default = "") — Specify the language String used in the URL, example: "en", "de", and so on.

Example
   Soma.getInstance().initLanguage(true, "en");
   Soma.getInstance().addEventListener(SomaEvent.LANGUAGE_CHANGED, languageHandler);
   Soma.getInstance().currentLanguage = "de";
   

registerClass()method 
public function registerClass(value:Class):String

Register a Class with the ClassImport instance to force its import by the compiler (useful with getDefinitionByName). You can get the class using the method Soma.getInstance().getClass.

   Soma.getInstance().registerClass(MyClass);
   

Parameters
value:Class — Class.

Returns
String — The String of the class name.
registerGloBalStyleSheet()method 
public function registerGloBalStyleSheet(url:String):void

Register the URL of a global stylesheet (css) to load at the initialization process. Soma will load the stylesheet (before the XML) and dispatch a StyleSheetEvent.LOADED event.

Parameters
url:String — URL of the global stylesheet.

Example
Soma.getInstance().registerGloBalStyleSheet("css/styles.css");
Soma.getInstance().addEventListener(StyleSheetEvent.LOADED, stylesheetHandler);
Soma.getInstance().start(this, "data/site.xml", new Config());

private function stylesheetHandler(e:StyleSheetEvent):void {
 trace(e.stylesheet);
 trace(Soma.getInstance().style.getStyleSheet(StyleManager.GLOBAL_STYLESHEET_ID));
}
      

removeEventListener()method 
public function removeEventListener(p_type:String, p_listener:Function, p_useCapture:Boolean = false):void

Parameters
p_type:String
 
p_listener:Function
 
p_useCapture:Boolean (default = false)
start()method 
public function start(ui:DisplayObjectContainer, xmlFile:String, config:IConfig):void

Starts the Soma framework. The 3 parameters are required: the main document class, the URL of the XML Site definition describing the site structure and a Config file (interface: com.interface.IConfig) containing information needed by the framework.
Part 1: Soma starts, creates the containers and initializes the global managers (such as controller, loader, config, ...).
Part 2: Soma loads the XML Site definition (and stylesheet if set before starting).
Part 3: Soma initializes the managers that need the XML Site definition (such as menu, loading, pages, styles, ...).
Part 4: Soma dispatches a SomaEvent.INITIALIZED when done.

Parameters
ui:DisplayObjectContainer — main Document Class (AS Entry Point), accessible using Soma.getInstance().ui
 
xmlFile:String — URL of the XML Site Definition to load (describing the structure of the site), accessible using Soma.getInstance().content.data
 
config:IConfig — user config file (containing framework options and global configuration), accessible using Soma.getInstance().config

Example
Soma.getInstance().addEventListener(SomaEvent.INITIALIZED, initialized);
Soma.getInstance().addEventListener(ContentEvent.LOADED, contentLoaded);
Soma.getInstance().registerGloBalStyleSheet("css/styles.css");
Soma.getInstance().start(this, "data/site.xml", new Config());

private function contentLoaded(e:ContentEvent = null):void {
    // xml and stylesheet have been loaded (components that don't require the XML Site Definition are initialized)
    trace(Soma.getInstance().container);
    trace(Soma.getInstance().content.data.toXMLString());
}

private function initialized(e:SomaEvent = null):void {
    // Soma is initialized
    trace(Soma.getInstance().page.currentPage);
}
      

startWithXML()method 
public function startWithXML(ui:DisplayObjectContainer, xml:XML, config:IConfig):void

Starts the Soma framework with an XML already loaded.

Parameters
ui:DisplayObjectContainer — main Document Class (AS Entry Point), accessible using Soma.getInstance().ui
 
xml:XML — XML Site Definition (describing the structure of the site), accessible using Soma.getInstance().content.data
 
config:IConfig — user config file (containing framework options and global configuration), accessible using Soma.getInstance().config

Example
Soma.getInstance().start(this, myXMLSiteDefinition, new Config());

willTrigger()method 
public function willTrigger(type:String):Boolean

Parameters
type:String

Returns
Boolean
Event detail
EXCLUDEDevent 
Event object type: 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);

See also

EXCLUDED_PARENTevent  
Event object type: 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);

See also

HIDEevent  
Event object type: com.soma.events.BackgroundEvent.HIDE

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

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

new BackgroundEvent(BackgroundEvent.HIDE, "myBackground").dispatch();

See also

INITIALIZEDevent  
Event object type: com.soma.events.SomaEvent.INITIALIZED

Indicates when Soma has been initialized.

Soma.getInstance().addEventListener(SomaEvent.INITIALIZED, eventHandler);

See also

LANGUAGE_CHANGEDevent  
Event object type: com.soma.events.SomaEvent.LANGUAGE_CHANGED

Indicates the language (string in the URL) has been changed.

Soma.getInstance().addEventListener(SomaEvent.LANGUAGE_CHANGED, eventHandler);

See also

LOADEDevent  
Event object type: com.soma.events.StyleSheetEvent.LOADED

Indicates when the XML Site Definition has been loaded.

Soma.getInstance().addEventListener(StyleSheetEvent.LOADED, eventHandler);

See also

LOADEDevent  
Event object type: com.soma.events.ContentEvent.LOADED

Indicates when the XML Site Definition has been loaded.

Soma.getInstance().addEventListener(ContentEvent.LOADED, eventHandler);

See also

OPEN_MENUevent  
Event object type: com.soma.events.MenuEvent.OPEN_MENU

Soma command that will be received by the user's custom menu (IMenu) to update the state of this menu when a new page is about to be displayed.

This event is automatically dispatched by the PageManager instance in some case, such as a URL change (Soma.getInstance().page).

Can also be used as a command from anywhere in the code, the parameter should be the ID of the page (id attribute in the XML Site Definition):

new MenuEvent(MenuEvent.OPEN_MENU, "myID").dispatch();

See also

SHOWevent  
Event object type: 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();

See also

SHOWevent  
Event object type: com.soma.events.BackgroundEvent.SHOW

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

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

new BackgroundEvent(BackgroundEvent.SHOW, "myBackground").dispatch();

See also

SHOW_EXTERNAL_LINKevent  
Event object type: 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();

See also

STARTEDevent  
Event object type: 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);

See also

TRANSITION_INevent  
Event object type: 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);

See also

TRANSITION_INevent  
Event object type: com.soma.events.BackgroundEvent.TRANSITION_IN

Indicates when a background is about to be displayed by the BackgroundManager instance (Soma.getInstance().background).

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

See also

TRANSITION_IN_COMPLETEevent  
Event object type: com.soma.events.PageEvent.TRANSITION_IN_COMPLETE

Indicates when a page has been displayed.

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

See also

TRANSITION_OUTevent  
Event object type: com.soma.events.PageEvent.TRANSITION_OUT

Indicates when a page is about to be hidden.

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

See also

TRANSITION_OUTevent  
Event object type: com.soma.events.BackgroundEvent.TRANSITION_OUT

Indicates when a background is about to be hidden by the BackgroundManager instance (Soma.getInstance().background).

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

See also

TRANSITION_OUT_COMPLETEevent  
Event object type: com.soma.events.PageEvent.TRANSITION_OUT_COMPLETE

Indicates when a page has been hidden.

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

See also

UPDATEDevent  
Event object type: com.soma.events.ContentEvent.UPDATED

Indicates when the XML Site Definition has been updated.

Soma.getInstance().addEventListener(ContentEvent.UPDATED, eventHandler);

See also

Constant detail
FIXED_LAYOUTconstant
public static const FIXED_LAYOUT:String = "fixed"

Constant value used to defined that the layout of the site is a fixed user interface, the width and height are fixed values applied to the main container (Soma.getInstance().container). The values are set in the XML Site definition <site layout="fixed" width="800" height="600">.

LIQUID_LAYOUTconstant 
public static const LIQUID_LAYOUT:String = "liquid"

Constant value used to defined that the layout of the site is a liquid user interface, the width and height of the main container is updated to fit the browser (Soma.getInstance().container). The values are set in the XML Site definition <site layout="liquid"> or <site>.

MODEL_BACKGROUNDconstant 
public static const MODEL_BACKGROUND:String = "com.soma.Soma.MODEL_BACKGROUND"

Constant value used to get a specific model class (manager) with the method getModel, example: Soma.getInstance().getModel(Soma.MODEL_BACKGROUND) equivalent to Soma.getInstance().background

MODEL_BASEconstant 
public static const MODEL_BASE:String = "com.soma.Soma.MODEL_BASE"

Constant value used to get a specific model class (manager) with the method getModel, example: Soma.getInstance().getModel(Soma.MODEL_BASE) equivalent to Soma.getInstance().base

MODEL_BASEUIconstant 
public static const MODEL_BASEUI:String = "com.soma.Soma.MODEL_BASEUI"

Constant value used to get a specific model class (manager) with the method getModel, example: Soma.getInstance().getModel(Soma.MODEL_BASEUI) equivalent to Soma.getInstance().baseUI

MODEL_CONFIGconstant 
public static const MODEL_CONFIG:String = "com.soma.Soma.MODEL_CONFIG"

Constant value used to get a specific model class (manager) with the method getModel, example: Soma.getInstance().getModel(Soma.MODEL_CONFIG) equivalent to Soma.getInstance().config

MODEL_CONTENTconstant 
public static const MODEL_CONTENT:String = "com.soma.Soma.MODEL_CONTENT"

Constant value used to get a specific model class (manager) with the method getModel, example: Soma.getInstance().getModel(Soma.MODEL_CONTENT) equivalent to Soma.getInstance().content

MODEL_LIBRARYconstant 
public static const MODEL_LIBRARY:String = "com.soma.Soma.MODEL_LIBRARY"

Constant value used to get a specific model class (manager) with the method getModel, example: Soma.getInstance().getModel(Soma.MODEL_LIBRARY) equivalent to Soma.getInstance().library

MODEL_LOADERconstant 
public static const MODEL_LOADER:String = "com.soma.Soma.MODEL_LOADER"

Constant value used to get a specific model class (manager) with the method getModel example: Soma.getInstance().getModel(Soma.MODEL_LOADER) equivalent to Soma.getInstance().loader

MODEL_MENUconstant 
public static const MODEL_MENU:String = "com.soma.Soma.MODEL_MENU"

Constant value used to get a specific model class (manager) with the method getModel, example: Soma.getInstance().getModel(Soma.MODEL_MENU) equivalent to Soma.getInstance().menu

MODEL_PAGEconstant 
public static const MODEL_PAGE:String = "com.soma.Soma.MODEL_PAGE"

Constant value used to get a specific model class (manager) with the method getModel, example: Soma.getInstance().getModel(Soma.MODEL_PAGE) equivalent to Soma.getInstance().page

MODEL_STYLEconstant 
public static const MODEL_STYLE:String = "com.soma.Soma.MODEL_STYLE"

Constant value used to get a specific model class (manager) with the method getModel, example: Soma.getInstance().getModel(Soma.MODEL_STYLE) equivalent to Soma.getInstance().styles

VERSIONconstant 
public static const VERSION:String = "2.0.2"

Constant value of the Soma Version.