| Package | net.guttershark.model |
| Class | public final dynamic class Model |
<?xml version="1.0" encoding="utf-8"?>
<model>
<content>
<text id="helloWorldExample"><![CDATA[Hello]]></text>
<text id="sparsley"><![CDATA[Some more example content]]></text>
</content>
<properties>
<propset id="test">
<textFormat id="theTextFormat" />
<alpha>0.5</alpha>
<xywh x="20" y="+30" width="+100" height="100" /> <!-- optional node for x/y/w/h -->
<y>+30</y>
<width>400</width>
<alpha>+.4</alpha>
</propset>
<propset id="tfieldTest">
<styleSheet id="colors3" />
<htmlText><![CDATA[<p><span class="pink">hello</span> <span class="some">w</span>orld</p>]]></htmlText>
<htmlText id="sparsley"/> <!-- optionally you can target a content/text node from the model, but not both. -->
</propset>
</properties>
<assets>
<asset libraryName="clayBanner1" source="clay_banners_1.jpg" preload="true" />
<asset libraryName="clayBanner2" source="clay_banners_2.jpg" />
<asset libraryName="clayWebpage" source="clay_webpage.jpg" />
<group id="sounds">
<asset libraryName="thesound" source="sound.mp3" path="sounds" />
</group>
</assets>
<links>
<link id="google" url="http://www.google.com" />
<link id="rubyamf" url="http://www.rubyamf.org" />
<link id="guttershark" url="http://www.guttershark.net" window="_blank" />
</links>
<attributes>
<attribute id="someAttribute" value="the value" />
</attributes>
<services>
<gateway id="amfphp" path="amfphp" url="http://localhost/amfphp/gateway.php" objectEncoding="3" />
<service id="test" gateway="amfphp" endpoint="Test" limiter="true" attempts="4" timeout="1000" />
<service id="foo" url="http://localhost/" attempts="4" timeout="1000" />
<service id="sessionDestroy" path="sessiondestroy" url="http://tagsf/services/codeigniter/session/destroy" attempts="4" timeout="1000" responseFormat="variables" />
<service id="ci" url="http://tagsf/services/codeigniter/" attempts="4" timeout="1000" responseFormat="variables" />
</services>
<stylesheets>
<stylesheet id="colors">
<![CDATA[
.pink{color:#FF0066}
]]>
</stylesheet>
<stylesheet id="colors2">
<![CDATA[
.some{color:#FF8548}
]]>
</stylesheet>
<stylesheet id="colors3" mergeStyleSheets="colors,colors2" />
</stylesheets>
<textformats>
<textformat id="theTF" font="Arial" color="0xFF0066" bold="true" />
</textformats>
<contextmenus>
<menu id="menu1">
<item id="home" label="home" />
<item id="back" label="GO BACK" sep="true"/>
</menu>
</contextmenus>
</model>
| Property | Defined by | ||
|---|---|---|---|
| flashvars : Object
A placeholder variable for the movies flashvars - this is
not set by default, you need to set it in your controller.
| Model | ||
| sharedObject : SharedObject
A placeholder variable for the movies shared object - this is
not set by default, override
restoreSharedObject
in your DocumentController, and set this property to a shared object. | Model | ||
| xml : XML
The XML used as the model.
| Model | ||
| Property | Defined by | ||
|---|---|---|---|
| assets : XMLList
Stores a reference to the <assets></assets>
node in the model xml.
| Model | ||
| attributes : XMLList
Stores a reference to the
<attributes></attributes>
node in the model xml. | Model | ||
| contents : XMLList
Stores a reference to the
<content></content>
node in the model xml. | Model | ||
| inst : Model
[static]
Singleton instance.
| Model | ||
| links : XMLList
Stores a reference to the
<links></links>
node in the model xml. | Model | ||
| properties : XMLList
Stores a reference to the
<properties></properties>
node in the model xml. | Model | ||
| services : XMLList
Stores a reference to the
<services></services>
node in the model xml. | Model | ||
| stylesheets : XMLList
Stores a reference to the
<stylesheets></stylesheets>
node in the model xml. | Model | ||
| textformats : XMLList
Stores a reference to the
<textformats></textformats>
| Model | ||
| Method | Defined by | ||
|---|---|---|---|
|
addPath(pathId:String, path:String):void
Add a URL path to the model - if ExternalInterface is available, it
uses the guttershark javascript api.
| Model | ||
|
createContextMenuById(id:String):ContextMenu
Creates a new context menu with the context menu manager,
from a menu that is defined in the model.
| Model | ||
|
disposeCache():void
Dispose of the internal cache.
| Model | ||
|
doesLinkExist(id:String):Boolean
Check whether or not a link is defined in the model.
| Model | ||
|
flushSharedObject():void
Flush the
sharedObject property. | Model | ||
|
getAssetByLibraryName(libraryName:String, prependSourcePath:String = null):Asset
Get an Asset instance by the library name.
| Model | ||
|
getAssetGroup(groupId:String):Array
Get an array of asset objects, defined by a group node.
| Model | ||
|
getAssetsByLibraryNames(... libraryNames):Array
Get an array of asset objects, from the provided library names.
| Model | ||
|
getAssetsForPreload():Array
Returns an array of Asset instances from the assets node,
that has a "preload" attribute set to true (preload='true').
| Model | ||
|
getAttribute(attributeID:String):String
Get the value from an attribute node.
| Model | ||
|
getContentById(id:String):String
Get's a piece of content from the content node in xml.
| Model | ||
|
getLink(id:String):URLRequest
Creates and returns a URLRequest from a link node.
| Model | ||
|
getLinkWindow(id:String):String
Get the window attribute value on a link node.
| Model | ||
|
getPath(... pathIds):String
Get a path concatenated from the given pathIds - if ExternalInterface is
available, it uses the guttershark javascript api.
| Model | ||
|
getStyleSheetById(id:String):StyleSheet
Get a StyleSheet object by the node id.
| Model | ||
|
getTextFormatById(id:String):TextFormat
Get a TextFormat object by the node id.
| Model | ||
|
[static]
Singleton access.
| Model | ||
|
initServices():void
Initializes all services defined in the model XML with the ServiceManager.
| Model | ||
|
isPathDefined(path:String):Boolean
Check whether or not a path has been defined.
| Model | ||
|
mergeStyleSheetsAs(newStyleId:String, ... styleIds):StyleSheet
Merge any number of style sheets declared in the model, as a new
stylesheet with a unique id.
| Model | ||
|
navigateToLink(id:String):void
Navigates to a link.
| Model | ||
| Method | Defined by | ||
|---|---|---|---|
|
checkForXML():void
Check that the model xml was set on the singleton instance before any attempts
to read the xml happens.
| Model | ||
| assets | property |
protected var assets:XMLListStores a reference to the <assets></assets> node in the model xml.
| attributes | property |
protected var attributes:XMLList
Stores a reference to the <attributes></attributes>
node in the model xml.
| contents | property |
protected var contents:XMLList
Stores a reference to the <content></content>
node in the model xml.
| flashvars | property |
public var flashvars:ObjectA placeholder variable for the movies flashvars - this is not set by default, you need to set it in your controller.
| inst | property |
protected static var inst:ModelSingleton instance.
| links | property |
protected var links:XMLList
Stores a reference to the <links></links>
node in the model xml.
| properties | property |
protected var properties:XMLList
Stores a reference to the <properties></properties>
node in the model xml.
| services | property |
protected var services:XMLList
Stores a reference to the <services></services>
node in the model xml.
| sharedObject | property |
public var sharedObject:SharedObject
A placeholder variable for the movies shared object - this is
not set by default, override restoreSharedObject
in your DocumentController, and set this property to a shared object.
| stylesheets | property |
protected var stylesheets:XMLList
Stores a reference to the <stylesheets></stylesheets>
node in the model xml.
| textformats | property |
protected var textformats:XMLList
Stores a reference to the <textformats></textformats>
| xml | property |
xml:XML [read-write]The XML used as the model.
Implementation public function get xml():XML
public function set xml(value:XML):void
| addPath | () | method |
public function addPath(pathId:String, path:String):voidAdd a URL path to the model - if ExternalInterface is available, it uses the guttershark javascript api. Otherwise it's stored in a local dictionary.
ParameterspathId:String — The path identifier.
|
|
path:String — The path.
|
public class Main extends DocumentController
{
//only called in standalone player, otherwise you must
//add paths through javascript - see the guttershark/lib/js/guttershark.js file.
override protected function initPathsForStandalone():void
{
ml.addPath("root","./");
ml.addPath("assets",ml.getPath("root")+"assets/");
ml.addPath("bitmaps",ml.getPath("root","assets")+"bitmaps/");
testPaths();
}
//illustrates how the "getPath" function works.
private function testPaths():void
{
trace(ml.getPath("root")); // -> ./
trace(ml.getPath("assets")); // -> ./assets/
trace(ml.getPath("bitmaps")); // -> ./assets/bitmaps/
}
}
| checkForXML | () | method |
protected function checkForXML():voidCheck that the model xml was set on the singleton instance before any attempts to read the xml happens.
| createContextMenuById | () | method |
public function createContextMenuById(id:String):ContextMenuCreates a new context menu with the context menu manager, from a menu that is defined in the model.
Parametersid:String — The id of the context menu to build and return.
|
ContextMenu |
| disposeCache | () | method |
public function disposeCache():voidDispose of the internal cache. The internal cache caches textformats and stylesheets.
| doesLinkExist | () | method |
public function doesLinkExist(id:String):BooleanCheck whether or not a link is defined in the model.
Parametersid:String — The link id.
|
Boolean |
| flushSharedObject | () | method |
public function flushSharedObject():void
Flush the sharedObject property.
| getAssetByLibraryName | () | method |
public function getAssetByLibraryName(libraryName:String, prependSourcePath:String = null):AssetGet an Asset instance by the library name.
ParameterslibraryName:String — The libraryName of the asset to create.
|
|
prependSourcePath:String (default = null) — The path to append to the source property of the asset.
|
Asset |
| getAssetGroup | () | method |
public function getAssetGroup(groupId:String):ArrayGet an array of asset objects, defined by a group node.
ParametersgroupId:String — The id of the group node.
|
Array |
| getAssetsByLibraryNames | () | method |
public function getAssetsByLibraryNames(... libraryNames):ArrayGet an array of asset objects, from the provided library names.
Parameters... libraryNames — An array of library names.
|
Array |
| getAssetsForPreload | () | method |
public function getAssetsForPreload():ArrayReturns an array of Asset instances from the assets node, that has a "preload" attribute set to true (preload='true').
ReturnsArray |
| getAttribute | () | method |
public function getAttribute(attributeID:String):StringGet the value from an attribute node.
ParametersattributeID:String — The id of an attribute node.
|
String |
| getContentById | () | method |
public function getContentById(id:String):StringGet's a piece of content from the content node in xml.
Parametersid:String — The text id.
|
String |
| getLink | () | method |
public function getLink(id:String):URLRequestCreates and returns a URLRequest from a link node.
Parametersid:String — The id of the link node.
|
URLRequest |
| getLinkWindow | () | method |
public function getLinkWindow(id:String):StringGet the window attribute value on a link node.
Parametersid:String — The id of the link node.
|
String |
| getPath | () | method |
public function getPath(... pathIds):StringGet a path concatenated from the given pathIds - if ExternalInterface is available, it uses the guttershark javascript api. Otherwise it's stored in a local dictionary.
Parameters... pathIds — An array of pathIds whose values will be concatenated together.
|
String |
| getStyleSheetById | () | method |
public function getStyleSheetById(id:String):StyleSheetGet a StyleSheet object by the node id.
Parametersid:String — The id of the stylesheet node to grab from the model.
|
StyleSheet |
| getTextFormatById | () | method |
public function getTextFormatById(id:String):TextFormatGet a TextFormat object by the node id.
Supports these attributes:
id:String |
TextFormat |
| gi | () | method |
| initServices | () | method |
public function initServices():voidInitializes all services defined in the model XML with the ServiceManager.
| isPathDefined | () | method |
public function isPathDefined(path:String):BooleanCheck whether or not a path has been defined.
Parameterspath:String |
Boolean |
| mergeStyleSheetsAs | () | method |
public function mergeStyleSheetsAs(newStyleId:String, ... styleIds):StyleSheetMerge any number of style sheets declared in the model, as a new stylesheet with a unique id. The new stylesheet is returned to you, and can be accessed again through the getStyleSheetById method. You can also declare merged style sheets in the model through xml. There is an example in examples/model/model.xml.
ParametersnewStyleId:String — The id to name the new merged stylesheet.
|
|
... styleIds — An array of style ids that are defined in the model.
|
StyleSheet |
| navigateToLink | () | method |
public function navigateToLink(id:String):voidNavigates to a link.
Parametersid:String — The link id.
|