Package | gs.control |
Class | public class DocumentController |
Inheritance | DocumentController ![]() ![]() |
Examples are in the guttershark repository. Most of the examples in the repository use the document controller.
Property | Defined by | ||
---|---|---|---|
flashvars : Object
Flashvars.
| DocumentController | ||
model : Model
A model instance.
| DocumentController | ||
preloader : Preloader
A preloader instance.
| DocumentController |
Method | Defined by | ||
---|---|---|---|
Constructor for DocumentController instances.
| DocumentController | ||
dispose():void
Dispose of this document controller.
| DocumentController | ||
![]() |
[static]
Get a document instance.
| Document | |
![]() |
[static]
Set a document instance.
| Document | |
![]() |
unset(id:String):void
[static]
Unset a document instance.
| Document |
Method | Defined by | ||
---|---|---|---|
flashvarsForStandalone():Object
Returns an object for standalone flashvars.
| DocumentController | ||
initFlashvars():void
Initialize flashvars.
| DocumentController | ||
initModel():void
Create and load a model.
| DocumentController | ||
initPaths():void
Initialize paths with the model.
| DocumentController | ||
initStage():void
Initialize the StageRef.stage property.
| DocumentController | ||
initStrings():void
Initialize a Strings instance on the model.
| DocumentController | ||
injectedFlashvarsKey():String
A hook you can use to tell the document controller
to grab the flashvars object from the FlashvarUtils
class as an "injected flashvar".
| DocumentController | ||
onModelIOError():void
A hook you can override to catch io loading errors for the model.
| DocumentController | ||
onModelReady():void
When a model is ready.
| DocumentController | ||
onModelSecurityError():void
A hook you can override to catch security errors for the model.
| DocumentController | ||
onPreloadComplete(e:Event):void
Override this to write preload complete logic.
| DocumentController | ||
registerDocumentKey():String
A hook you can use to override what key is used
when the DocumentController is registered with
Document.set.
| DocumentController | ||
registerFlashvarsKey():String
A hook you can use to override what key is used
when the flashvars object is register with FlashvarUtils.set.
| DocumentController | ||
registerInstances():void
A hook you can override to register instances with their
classes.
| DocumentController | ||
registerModelKey():String
A hook you can use to override what key is used
when the model is registered with Model.set.
| DocumentController | ||
setupComplete():void
A hook called just before the startPreload method is called.
| DocumentController | ||
startPreload():void
A hook to start preloading.
| DocumentController |
flashvars | property |
protected var flashvars:Object
Flashvars.
model | property |
protected var model:Model
A model instance.
preloader | property |
protected var preloader:Preloader
A preloader instance.
DocumentController | () | constructor |
public function DocumentController()
Constructor for DocumentController instances.
public function DocumentController() { initStage(); initFlashvars(); initModel(); initPaths(); }
dispose | () | method |
public override function dispose():void
Dispose of this document controller.
flashvarsForStandalone | () | method |
protected function flashvarsForStandalone():Object
Returns an object for standalone flashvars.
ReturnsObject |
protected function flashvarsForStandalone():Object { return {}; }
initFlashvars | () | method |
protected function initFlashvars():void
Initialize flashvars.
protected function initFlashvars():void { if(qs.flashvarsurl)loadFlashvars(); else { if(injectedFlashvarsKey())flashvars=FlashvarUtils.get(injectedFlashvarsKey()); if(!flashvars)flashvars=FlashvarUtils.getFlashvars(this,flashvarsForStandalone); } }
initModel | () | method |
protected function initModel():void
Create and load a model.
protected function initModel():void { model=new Model(); if(flashvars.model)model.load(flashvars.model,onModelReady,onModelIOError,onModelSecurityError); else onModelReady(); }
initPaths | () | method |
protected function initPaths():void
Initialize paths with the model.
protected function initPaths():void { if(model) { model.addPath("audio",(flashvars.audio)?flashvars.audio:"../audio/"); model.addPath("bmp",(flashvars.bmp)?flashvars.bmp:"../bmp/"); model.addPath("css",(flashvars.css)?flashvars.css:"../css/"); model.addPath("flv",(flashvars.flv)?flashvars.flv:"../flv/"); model.addPath("js",(flashvars.js)?flashvars.js:"../js/"); model.addPath("swf",(flashvars.swf)?flashvars.swf:"../swf/"); model.addPath("xml",(flashvars.xml)?flashvars.xml:"../xml/"); } }
initStage | () | method |
protected function initStage():void
Initialize the StageRef.stage property.
protected function initStage():void { StageRef.stage=stage; }
initStrings | () | method |
protected function initStrings():void
Initialize a Strings instance on the model.
If an asset is available in the AssetManager called "strings" it will initialize the model.strings property for you
protected function initStrings():void { if(AssetManager.isAvailable("strings") && model)model.strings=new Strings(AssetManager.getXML("strings")); }
injectedFlashvarsKey | () | method |
protected function injectedFlashvarsKey():String
A hook you can use to tell the document controller to grab the flashvars object from the FlashvarUtils class as an "injected flashvar".
Look at the docs for initFlashvars for how the injectedFlashvarsKey is used to get custom flashvars.
ReturnsString |
onModelIOError | () | method |
protected function onModelIOError():void
A hook you can override to catch io loading errors for the model.
onModelReady | () | method |
protected function onModelReady():void
When a model is ready.
protected function onModelReady():void { setupComplete(); startPreload(); }
onModelSecurityError | () | method |
protected function onModelSecurityError():void
A hook you can override to catch security errors for the model.
onPreloadComplete | () | method |
protected function onPreloadComplete(e:Event):void
Override this to write preload complete logic.
Parameterse:Event |
protected function onPreloadComplete(e:Event):void { model.registerFonts(); initStrings(); registerInstances(); }
registerDocumentKey | () | method |
protected function registerDocumentKey():String
A hook you can use to override what key is used when the DocumentController is registered with Document.set.
The default is main
ReturnsString |
registerFlashvarsKey | () | method |
protected function registerFlashvarsKey():String
A hook you can use to override what key is used when the flashvars object is register with FlashvarUtils.set.
The default is main
ReturnsString |
registerInstances | () | method |
protected function registerInstances():void
A hook you can override to register instances with their classes.
protected function registerInstances():void { if(model)Model.set(registerModelKey(),model); if(flashvars)FlashvarUtils.set(registerFlashvarsKey(),flashvars); Document.set(registerDocumentKey(),this); }
registerModelKey | () | method |
protected function registerModelKey():String
A hook you can use to override what key is used when the model is registered with Model.set.
The default is main
ReturnsString |
setupComplete | () | method |
protected function setupComplete():void
A hook called just before the startPreload method is called.
This is called after initStage, initFlashvars, and after a model has loaded.
startPreload | () | method |
protected function startPreload():void
A hook to start preloading.