| Package | com.soma.core.view |
| Class | public class SomaViews |
| Inheritance | SomaViews Object |
Author: Romuald Quantin - www.soundstep.com
Resources: http://www.soundstep.com/downloads/somacore
Actionscript version: 3.0
Copyright: Mozilla Public License 1.1 (MPL 1.1) http://www.opensource.org/licenses/mozilla1.1.php
The SomaViews class handles the views of the application (DisplayObject).| Method | Defined By | ||
|---|---|---|---|
Create an instance of the SomaViews class. | SomaViews | ||
addView(viewName:String, view:Object):Object
Registers a view to the framework. | SomaViews | ||
dispose():void
Destroys all the views and properties. | SomaViews | ||
getView(viewName:String):Object
Retrieves the view instance that has been registered using its name. | SomaViews | ||
getViews():Dictionary
Retrieves all the view instances that have been registered to the framework. | SomaViews | ||
hasView(viewName:String):Boolean
Indicates wether a view has been registered to the framework. | SomaViews | ||
removeView(viewName:String):void
Removes a view from the framework and call the (optional) dispose method of this view. | SomaViews | ||
| SomaViews | () | Constructor |
public function SomaViews()Create an instance of the SomaViews class. Should not be directly instantiated, the framework will instantiate the class.
| addView | () | method |
public function addView(viewName:String, view:Object):ObjectRegisters a view to the framework.
Parameters
viewName:String — Name of the view.
| |
view:Object — Instance of the view.
|
Object — The view instance.
|
addView(MySprite.NAME, new MySprite());
| dispose | () | method |
public function dispose():voidDestroys all the views and properties. The class will call the dispose method of each view instance.
| getView | () | method |
public function getView(viewName:String):ObjectRetrieves the view instance that has been registered using its name.
Parameters
viewName:String — Name of the view.
|
Object — An Object instance.
|
var mySprite:MySprite = getView(MySprite.NAME) as MySprite;
| getViews | () | method |
public function getViews():DictionaryRetrieves all the view instances that have been registered to the framework.
ReturnsDictionary — A Dictionary (the key of the Dictionary is the name used for the registration).
|
var sprites:Dictionary = getViews();
| hasView | () | method |
public function hasView(viewName:String):BooleanIndicates wether a view has been registered to the framework.
Parameters
viewName:String — Name of the view.
|
Boolean — A Boolean.
|
hasView(MySprite.NAME);
| removeView | () | method |
public function removeView(viewName:String):voidRemoves a view from the framework and call the (optional) dispose method of this view.
Parameters
viewName:String — Name of the view.
|
removeView(MySprite.NAME);
addView(MySprite.NAME, new MySprite());
removeView(MySprite.NAME);
var sprite:MySprite = getView(MySprite.NAME) as MySprite;
private function get mySprite():MySprite {
return getView(MySprite.NAME) as MySprite;
}
private function doSomething():void {
trace(mySprite);
}