Packagenet.guttershark.control
Classpublic class DocumentController
InheritanceDocumentController Inheritance flash.display.Sprite

The DocumentController class is the base Document Class for all sites. The DocumentController provides default functionality that 90% of flash sites need. This should always be extended and never used directly.

By providing any of the following flash var properties, you initiate default functionality.

Available FlashVar Properties:

FlashVar properties can be declared when running in the Flash IDE by overriding the flashvarsForStandalone() method. Otherwise you need to put the flashvars on the flash object in HTML.


Example
Overriding the flashvarsForStandalone method to provide flashvars for IDE development:
 
  override protected function flashvarsForStandalone():Object
  {
      return {model:"model.xml",
         initRemotingEndpoints:"amfphp",
         sniffCPU:true,
         sniffBandwidth:true,
         onlineStatus:true
      };
  } 
  

Declaring FlashVars on a Flash object with SWFObject:
 
  <script type="text/javascript">
      // <![CDATA[
      var so = new SWFObject("main.swf", "flaswf", "100%", "100%", "9", "#000");
      so.addVariable("model","model.xml");
      so.addVariable("sniffCPU",true);
      so.addVariable("sniffBandwidth",true);
      so.addVariable("akamaiHost","http://cp44952.edgefcs.net/");
      so.addVariable("onlineStatus",true);
      so.addVariable("onlineStatusPingFrequency",120000);
      so.addVariable("initRemotingEndpoints","amfphp,rubyamf");
      // ]]>
  </script>
  

See the examples in from SVN in "examples/shells" for more examples of using different snippets of the default functionality.



Public Properties
 PropertyDefined by
  flashvars : Object
FlashVars on this movie.
DocumentController
  Instance : *
[static][read-only] The instance of the site controller.
DocumentController
  model : XML
The model XML.
DocumentController
  online : Boolean
Online indicator.
DocumentController
  queryString : QueryString
A query string object used for deeplink data reading.
DocumentController
  sharedObject : SharedObject
A shared object for this application.
DocumentController
Public Methods
 MethodDefined by
  
Constructor for DocumentController instances.
DocumentController
  
A convenience method for flushing the sharedObject property on this site controller to disk.
DocumentController
  
Start the online status pinging.
DocumentController
  
Stop the online status pinging.
DocumentController
Protected Methods
 MethodDefined by
  
akamaiIdentComplete(ip:String):void
A method you can override to hook into the complete event from the akamai ident hit.
DocumentController
  
A method you can override to hook into the application offline event.
DocumentController
  
A method you can override to hook into the application online event.
DocumentController
  
A method you can override when publishing from the flash IDE to provide a default set of flash vars.
DocumentController
  
A method you can override to hook into the bandwidth sniff complete event.
DocumentController
  
A method you can override when publishing from the flash IDE to provide a default set of querystring data.
DocumentController
  
A method you can override to restore a shared object from disk.
DocumentController
  
A method you should override that provides the final hook in the chain of setup method calls.
DocumentController
Property detail
flashvarsproperty
public var flashvars:Object

FlashVars on this movie.

Instanceproperty 
Instance:*  [read-only]

The instance of the site controller. This will always return the lowest child in a chain of subclasses. If the DocumentController is extended by a class called Main, this would return an instance of Main.

Implementation
    public static function get Instance():*
modelproperty 
public var model:XML

The model XML. This comes from loading an xml file provided by flashvars.model property.

onlineproperty 
public var online:Boolean

Online indicator.

queryStringproperty 
public var queryString:QueryString

A query string object used for deeplink data reading.

sharedObjectproperty 
public var sharedObject:SharedObject

A shared object for this application.

Constructor detail
DocumentController()constructor
public function DocumentController()

Constructor for DocumentController instances. This should not be used directly, only subclassed.

Method detail
akamaiIdentComplete()method
protected function akamaiIdentComplete(ip:String):void

A method you can override to hook into the complete event from the akamai ident hit. This will only be called if you provided the akamaiHost property in flashvars.

You should hook into this for two things.

Parameters
ip:String — The IP that was found from the Ident service.

See also

applicationOffline()method 
protected function applicationOffline():void

A method you can override to hook into the application offline event. This is only useful if you've opted into the onlineStatus flashvar property.

applicationOnline()method 
protected function applicationOnline():void

A method you can override to hook into the application online event. This is only useful if you've opted into the onlineStatus flashvar property.

flashvarsForStandalone()method 
protected function flashvarsForStandalone():Object

A method you can override when publishing from the flash IDE to provide a default set of flash vars. This is because flashvars won't exist when publishing from the flash IDE.

Returns
Object — A generic object with hard coded custom flashvar keys.
flushSharedObject()method 
public function flushSharedObject():String

A convenience method for flushing the sharedObject property on this site controller to disk.

Returns
String — A property from the SharedObjectFlushStatus class.
onBandwidthSniffComplete()method 
protected function onBandwidthSniffComplete():void

A method you can override to hook into the bandwidth sniff complete event.

queryStringForStandalone()method 
protected function queryStringForStandalone():Dictionary

A method you can override when publishing from the flash IDE to provide a default set of querystring data. The custom data get's set on the queryString property so you can continue to use that property without worrying about if your in the IDE or not.

Returns
Dictionary — A dictionary with deeplink keys and values.
restoreSharedObject()method 
protected function restoreSharedObject():void

A method you can override to restore a shared object from disk.


Example
Using the sharedObject property to restore the shared object to:
 
   override protected function restoreSharedObject():void
   {
     sharedObject = SharedObject.getLocal("test");
   }
   

setupComplete()method 
protected function setupComplete():void

A method you should override that provides the final hook in the chain of setup method calls.

If a model file is being loaded, setupComplete will wait to be called until after the xml is loaded. But will not wait for bandwidth sniff or akamai ident hits. Use onBandwidthSniffComplete() and akamaiIdentComplete()

startOnlineStatus()method 
public function startOnlineStatus():void

Start the online status pinging. The online status pinging will start by default if you specify the onlineStatus flashvar property. This should be used to restart the pinging if you stopped it at some point.

stopOnlineStatus()method 
public function stopOnlineStatus():void

Stop the online status pinging.