| Package | com.soma.model |
| Class | public class BaseManager |
| Implements | IDisposable |
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
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
Soma.getInstance().base.container
<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"/>
var myText:SomaText = Soma.getInstance().base.getElementByID("myText") as SomaText;
var list:Dictionary = Soma.getInstance().base.assets;
See also
| Property | Defined 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 | ||
| Method | Defined 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 | ||
| assets | property |
assets:Array [read-only]Get an array containing the assets created from XML nodes.
Implementation public function get assets():Array
| baseUI | property |
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
| container | property |
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
| loader | property |
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
| parser | property |
parser:NodeParser [read-only]Get the NodeParser instance used to parse the nodes and instantiate the backgrounds.
Implementation public function get parser():NodeParser
| BaseManager | () | constructor |
public function BaseManager()Creates a BaseManager instance, the global BaseManager instance is accessible using Soma.getInstance().base.
| dispose | () | method |
public function dispose():voidDisposes the BaseManager instance. Removes listeners and destroys assets, parser and container.
| getElementByID | () | method |
public function getElementByID(id:String):DisplayObjectGet an asset in the container using its attribute id from the XML node.
Parametersid:String |
DisplayObject — A DisplayObject instance.
|
| start | () | method |
public function start():voidEntry point of the BaseManager, it will create (and load) the assets from the children nodes of the base node from the XML Site Definition.