ObjectViewer Class
Class com.blitzagency.xray.ObjectViewer
Inheritance
>
ObjectViewer
ObjectViewer has 2 over all jobs:
1. Recurse application and return XML formatted view for the interface's treeview component
2. Return object data to the interface
It's core concept is to return information about the application. All calls to the OV come through ControlConnection
| Property Summary |
|---|
| private Number | _recursionCount is a fractional counter that allows an object to be looped several times yet avoid the 256 recursion error. |
| Function | |
| private Array | button property array - represents all of the properties we want to have returned about a Button object |
| private String | Used in buildTree for stripping out unecessary path information on objects |
| Function | |
| private Array | movieclip property array - represents all of the properties we want to have returned about a MovieClip object |
| private Array | movieclip property small array - represents all of the properties we want to have returned about a MovieClip object, this is the short version |
| private Object | objMap is used by buildTree function. |
| Function | |
| private Array | sound property array - represents all of the properties we want to have returned about a Sound object |
| private Array | textfield property array - represents all of the properties we want to have returned about a TextField object |
| XML | The actual XML Object that is finally returned to the caller |
| String | XMLStr is what buildTree adds to as it recurses objMap. |
| Method Summary |
|---|
| private Void | _protect(package_obj:Object, unprotected_array:Array) _protect is for resetting prop flags via ASSetPropFlags - I hadn't implemented since it didn't seem to work on small tests, but I've left here for further review |
| private Void | addObject(link:String, iType:Number, sName:String) addObject is called during the recursion process (parseTree) to build an Object structure that mirrors the application |
| Void | buildTree parses the objMap object and creates an XML representation of the application |
| Object | getFunctionProperties - not sure if this is old. There is reference to it in ControlConnection.as
- John 8.3.2005 10.12pm EST |
| private String | getName is used to return either a _name property if the object is a movieclip, or the sClip. This is
weird in that clip can be a String or Movieclip |
| Object | getObjProperties was meant to be a one stop shop to get all other properties beyond the array props (mc_prop_ary and so on) |
| Object | getProperties is the main call to return all data about a Movieclip/Button/TextField/Sound object |
| Object | getSoundProperties is used to return specific Sound object information including ID3 object properties |
| Object | getStandardProperties is currently not in use. It was created to be an abreviated list of main properties about a movieclip. |
| private Number | getType returns a number representing the "type" of object sent in |
| Object | |
| Void | parseTree(obj:Object, sName:String, sPath:String, recursiveSearch:Boolean, showHidden:Boolean, objectSearch:Boolean, parent:Object, lastParent:Object) parseTree is responsible for recursing the application and adding objects to the objMap via addObject() method |
| private String | replace(str:String, srch_str:String, repl_str:String) replace works with strings to change out certain characters that might not be XML friendly |
| private Void | setAttributes takes the object passed in and adds the properties as attributes to the XMLNode sent in |
| XML | viewTree(obj:Object, objPath:String, recursiveSearch:Boolean, showHidden:Boolean, objectSearch:Boolean) viewTree is where the process starts for building an XML view of the application. |
ObjectViewer
function ObjectViewer()
_recursionCount
private var _recursionCount:Number;
_recursionCount is a fractional counter that allows an object to be looped several times yet avoid the 256 recursion error.
When an object is first found in a loop, it's __recursionCheck is updated to match Xray.recursionControl. Then, __recursionCheck is added
to with .001. The _recursionCount number represents the "cap" times an object can be recursed.
The current setting is .003 = it can be recursed and shown 3 times. This number could be as high as 255, but the higher the number
the slower the process
addEventListener
var addEventListener:Function;
Button_prop_ary
private var Button_prop_ary:Array;
button property array - represents all of the properties we want to have returned about a Button object
currentObjPath
private var currentObjPath:String;
Used in buildTree for stripping out unecessary path information on objects
dispatchEvent
var dispatchEvent:Function;
mc_prop_ary
private var mc_prop_ary:Array;
movieclip property array - represents all of the properties we want to have returned about a MovieClip object
mc_prop_small_ary
private var mc_prop_small_ary:Array;
movieclip property small array - represents all of the properties we want to have returned about a MovieClip object, this is the short version
objMap
private var objMap:Object;
objMap is used by buildTree function. It contains a physical view of the app's structure. buildTree function will recurse
this object to create the xml that is returned to the interface.
The point of using a separate object rather than building the XML while in the initial recursion (see viewTree function),
is so that we can format/sort the items that are returned in the xml
removeEventListener
var removeEventListener:Function;
Sound_prop_ary
private var Sound_prop_ary:Array;
sound property array - represents all of the properties we want to have returned about a Sound object
TextField_prop_ary
private var TextField_prop_ary:Array;
textfield property array - represents all of the properties we want to have returned about a TextField object
XMLDoc
public var XMLDoc:XML;
The actual XML Object that is finally returned to the caller
XMLStr
public var XMLStr:String;
XMLStr is what buildTree adds to as it recurses objMap. This will then be converted to a true XML object with XMLDoc, and returned to the caller
_protect
private function _protect(package_obj:Object, unprotected_array:Array):Void
Returns:
nothing
addObject
private function addObject(link:String, iType:Number, sName:String):Void
Parameters:
link:String- "_level0.home.news.latest"
iType:Number- represents type of object (refer to getType())
sName:Sting- name of the item
Returns:
nothing
buildTree
function buildTree(obj:Object):Void
Parameters:
Returns:
nothing
getFunctionProperties
public function getFunctionProperties(obj, sPath):Object
Returns:
Object
getName
private function getName(clip:Object):String
Parameters:
Returns:
String
getObjProperties
public function getObjProperties(obj:Object):Object
Parameters:
Returns:
Object
getProperties
public function getProperties(target_obj:Object, showAll:Boolean):Object
Parameters:
target_obj:Object- can be either MovieClip, Button, TextField or Sound object
showAll:Boolean- whether or not to loopthe object for all other properties and methods
Returns:
Object
getSoundProperties
public function getSoundProperties(snd:Sound):Object
Parameters:
Returns:
Object
getStandardProperties
public function getStandardProperties(target_mc:MovieClip):Object
Parameters:
target_mc:MovieClip- MovieClip reference
Returns:
Object
getType
private function getType(obj:Object):Number
Parameters:
Returns:
number
getVideoProperties
public function getVideoProperties(ns:NetStream):Object
Parameters:
ns:NetStream- - NetStream object
Returns:
Object
parseTree
public function parseTree(obj:Object, sName:String, sPath:String, recursiveSearch:Boolean, showHidden:Boolean, objectSearch:Boolean, parent:Object, lastParent:Object):Void
Parameters:
obj:Object- this can be a MovieClip, Button, TextField, Sound, Object, Array - an object.
objPath:String- starting path.
recursiveSearch:Boolean- whether or not to loop more than one object per call.
showHidden:Boolean- whether or not to apply ASSetPropFlags to objects as we recurse.
objectSearch:Boolean- based on whether or not an object is a true "Object"
parent:String- name of parent
lastParent:String- name of last parent
Returns:
nothing
replace
private function replace(str:String, srch_str:String, repl_str:String):String
Parameters:
str:String- string object to work with
srch_str:String- what you're wanting to replace
repl_str:String- what you want to put in place
Returns:
String
setAttributes
private function setAttributes(xmlNode:XMLNode, obj:Object):Void
Parameters:
xmlNode:XMLNodeobj:Object- properties to convert to attributes
Returns:
nothing
viewTree
public function viewTree(obj:Object, objPath:String, recursiveSearch:Boolean, showHidden:Boolean, objectSearch:Boolean):XML
Parameters:
obj:Object- this can be a MovieClip, Button, TextField, Sound, Object, Array - an object.
objPath:String- starting path.
recursiveSearch:Boolean- whether or not to loop more than one object per call.
showHidden:Boolean- whether or not to apply ASSetPropFlags to objects as we recurse.
Returns:
XML
Documentation generated by BLDoc Community Edition from B-Line Express.