Packagecom.soma.model
Classpublic class BaseManager
ImplementsIDisposable

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:
The BaseManager handles assets in a Sprite layer between the background layer and the site layer, it is ideal to display elements (assets) that have to stay on screen (such as a logo, a footer or other design elements). from nodes contained in a base node in the XML Site Definition. Soma provides an easy way to create those assets, they can automatically be loaded and/or instantiated from the XML Site Definition (nodes children of a base node).

The global base manager instance is accessible using:

Soma.getInstance().base
The assets container (Sprite) is accessible using:
Soma.getInstance().base.container
The assets supported are the the ones supported by the NodeParser class (see link below), they can be text, image, bitmap, movieclip, video or your own custom classes, here are some examples:
<text id="myText" style="body" x="10" y="10" width="200"><![CDATA[Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer sed massa turpis, sit amet ornare nisl.]]></text>
<video id="myVideo" url="video/video.flv" x="50" alpha=".5" verticalCenter="0" volume="0" />
<image id="myImage" file="image.png" scaleX=".5" scaleY=".5" blendMode="multiply" ratio="ratio_in"/>
<bitmap id="myBitmap" linkage="AssetClassNameBitmap" x="170" y="170" blendMode="multiply" scaleX=".3" scaleY=".3"/>
<movieclip id="myMovieClip" linkage="AssetClassNameMovieClip" x="170" y="280" scaleX=".3" scaleY=".3"/>
     
The assets can be retrieved using the getElementByID method and assets property, the parser and loader instance are also accessible for any need to listen to events.

     var myText:SomaText = Soma.getInstance().base.getElementByID("myText") as SomaText;
     var list:Dictionary = Soma.getInstance().base.assets;
     

See also

Soma
NodeParser
ParserEvent
SomaLoader
SomaLoaderEvent


Public Properties
 PropertyDefined by
  assets : Array
[read-only] Get an array containing the assets created from XML nodes.
BaseManager
  baseUI : BaseUI
[read-only] Get the BaseUI instance used if BaseUI properties have been found in the XML (such as ratio, alignX and so on).
BaseManager
  container : Sprite
[read-only] Get the Sprite container that contains the assets, this container is by default on the index 1 in the display list (added to the main class).
BaseManager
  loader : SomaLoader
[read-only] Get the SomaLoader instance used to load the backgrounds.
BaseManager
  parser : NodeParser
[read-only] Get the NodeParser instance used to parse the nodes and instantiate the backgrounds.
BaseManager
Public Methods
 MethodDefined by
  
Creates a BaseManager instance, the global BaseManager instance is accessible using Soma.getInstance().base.
BaseManager
  
dispose():void
Disposes the BaseManager instance.
BaseManager
  
getElementByID(id:String):DisplayObject
Get an asset in the container using its attribute id from the XML node.
BaseManager
  
start():void
Entry point of the BaseManager, it will create (and load) the assets from the children nodes of the base node from the XML Site Definition.
BaseManager
Property detail
assetsproperty
assets:Array  [read-only]

Get an array containing the assets created from XML nodes.

Implementation
    public function get assets():Array
baseUIproperty 
baseUI:BaseUI  [read-only]

Get the BaseUI instance used if BaseUI properties have been found in the XML (such as ratio, alignX and so on).

Implementation
    public function get baseUI():BaseUI
containerproperty 
container:Sprite  [read-only]

Get the Sprite container that contains the assets, this container is by default on the index 1 in the display list (added to the main class).

Implementation
    public function get container():Sprite
loaderproperty 
loader:SomaLoader  [read-only]

Get the SomaLoader instance used to load the backgrounds. This instance is the global loader instance (Soma.getInstance().loader), any action on this loader will affect the whole site.

Implementation
    public function get loader():SomaLoader
parserproperty 
parser:NodeParser  [read-only]

Get the NodeParser instance used to parse the nodes and instantiate the backgrounds.

Implementation
    public function get parser():NodeParser
Constructor detail
BaseManager()constructor
public function BaseManager()

Creates a BaseManager instance, the global BaseManager instance is accessible using Soma.getInstance().base.

Method detail
dispose()method
public function dispose():void

Disposes the BaseManager instance. Removes listeners and destroys assets, parser and container.

getElementByID()method 
public function getElementByID(id:String):DisplayObject

Get an asset in the container using its attribute id from the XML node.

Parameters
id:String

Returns
DisplayObject — A DisplayObject instance.
start()method 
public function start():void

Entry point of the BaseManager, it will create (and load) the assets from the children nodes of the base node from the XML Site Definition.