org.silex.core.DynDataManager

This class does all the work of saving/reading sections data in/from db.  In the repository : /trunk/core/DynDataManager.as

Version

1

Author

Alexandre Hoyau

Summary
org.silex.core.DynDataManagerThis class does all the work of saving/reading sections data in/from db.
Variables
silex_ptrReference to silex main Api object (org.silex.core.Api).
Functions
DynDataManagerConstructor.
registerVariableRegister a variable in SILEX: - load the corresponding value from dom to the variable - mark the variable so that its value will be saved into the dom when core.silex.save will be called
unRegisterVariableRemoves a variable from the registeredVariables array.
unRegisterClipOutOfContextStop keeping track of that variable so that its value will be updated in the dom during the save process.
registerClipOutOfContextKeep track of the variable so that it will still be saved in db, even if the container does not exist anymore (because it is out of context).
duplicateDomDuplicate a dom object and its child objects.
buildLayoutDomUse a layout’s registeredVariables array to build it’s dom object.
addValueToDomUpdate the a variable in the dom object.

Variables

silex_ptr

var silex_ptr: org.silex.core.Api

Reference to silex main Api object (org.silex.core.Api).

Functions

DynDataManager

function DynDataManager (api: org.silex.core.Api)

Constructor.

registerVariable

function registerVariable(target_mc: MovieClip,
variableName: String,
type: String):Boolean

Register a variable in SILEX: - load the corresponding value from dom to the variable - mark the variable so that its value will be saved into the dom when core.silex.save will be called

Parameters

target_mcthe object which contains the variable to be registered
variableNamethe name of the variable
type[optional] - the type of the variable (as returned by typeof ActionScript function)

Returns

true if a value was found in the XML and false otherwise

unRegisterVariable

function unRegisterVariable(target_mc: MovieClip,
variableName: String):Boolean

Removes a variable from the registeredVariables array.  Not used?!  TO BE TESTED

Parameters

target_mcthe object which contains the variable to be registered
variableNamethe name of the variable

unRegisterClipOutOfContext

function unRegisterClipOutOfContext(target_mc: MovieClip,
variableName: String)

Stop keeping track of that variable so that its value will be updated in the dom during the save process.  There are still some BUGs in this process.

Parameters

target_mcthe object which contains the variable to be registered
variableNamethe name of the variable

registerClipOutOfContext

function registerClipOutOfContext(target_mc: MovieClip,
variableName: String):Boolean

Keep track of the variable so that it will still be saved in db, even if the container does not exist anymore (because it is out of context).  Retrieve the layout root and the path of the target.  Retrieve the corresponding dom node in layout’s dom object.  Add the target’s dom to the domOutOfContext of the layout.  There are still some BUGs in this process.

Parameters

target_mcthe object which contains the variable to be registered
variableNamethe name of the variable

duplicateDom

function duplicateDom(_obj: Object):Object

Duplicate a dom object and its child objects.  Recursive function.

Parameters

param _obj the dom object to be duplicated

Returns

the duplicated dom object

buildLayoutDom

function buildLayoutDom(layout: org.silex.core.Layout)

Use a layout’s registeredVariables array to build it’s dom object.  The registeredVariables elements have these attributes: variableName_str,containerPath_array,type_str, target_str (which is the container_mc.target property).

Parameters

layoutthe layout

addValueToDom

private function addValueToDom(dom: Object,
path_array: Array,
variableName: String,
variableValue )

Update the a variable in the dom object.

Parameters

domthe dom object
path_arraythe path of the variable
variableValuethe variable’s value
var silex_ptr: org.silex.core.Api
Reference to silex main Api object (org.silex.core.Api).
function DynDataManager (api: org.silex.core.Api)
Constructor.
function registerVariable(target_mc: MovieClip,
variableName: String,
type: String):Boolean
Register a variable in SILEX: - load the corresponding value from dom to the variable - mark the variable so that its value will be saved into the dom when core.silex.save will be called
function unRegisterVariable(target_mc: MovieClip,
variableName: String):Boolean
Removes a variable from the registeredVariables array.
function unRegisterClipOutOfContext(target_mc: MovieClip,
variableName: String)
Stop keeping track of that variable so that its value will be updated in the dom during the save process.
function registerClipOutOfContext(target_mc: MovieClip,
variableName: String):Boolean
Keep track of the variable so that it will still be saved in db, even if the container does not exist anymore (because it is out of context).
function duplicateDom(_obj: Object):Object
Duplicate a dom object and its child objects.
function buildLayoutDom(layout: org.silex.core.Layout)
Use a layout’s registeredVariables array to build it’s dom object.
private function addValueToDom(dom: Object,
path_array: Array,
variableName: String,
variableValue )
Update the a variable in the dom object.