This could be an easy way to document your component. We need track the properties and methods of a component by looping through the instance. Say for example the following example can generate the color syntax xml for any component instance, we need to delete unwanted entries manually that’s all.
[cc lang=”actionscript3″]
var d = _global.akComponentDoc=new Object();
d.getColorSyntax = function(obj) {
var arr = new Array();
for (i in obj) {
if (typeof (obj[i]) == ‘function’ && substring(i, 1, 2) != “my“) {
arr.push(‘t<identifier text=”.’+i+’“/>n’);
}
}
arr.sort();
return ‘<colorsyntax>n’+arr.join(”)+'</colorsyntax>n’;
};
trace(d.getColorSyntax(PushButtonInstance));
[/cc]
The above code generated the xml below
[cc lang=”actionscript3″]
<colorsyntax>
<identifier text=”.accDoDefaultAction”/>
<identifier text=”.arrangeLabel”/>
<identifier text=”.cleanUI”/>
<identifier text=”.cleanUINotSize”/>
<identifier text=”.drawFocusRect”/>
<identifier text=”.drawFrame”/>
<identifier text=”.drawRect”/>
<identifier text=”.executeCallBack”/>
<identifier text=”.getBtnState”/>
<identifier text=”.getEnabled”/>
<identifier text=”.getLabel”/>
<identifier text=”.get_accDefaultAction”/>
<identifier text=”.get_accName”/>
<identifier text=”.get_accRole”/>
<identifier text=”.get_accState”/>
<identifier text=”.init”/>
<identifier text=”.initContentPos”/>
<identifier text=”.invalidate”/>
<identifier text=”.onDragOut”/>
<identifier text=”.onDragOver”/>
<identifier text=”.onPress”/>
<identifier text=”.onRelease”/>
<identifier text=”.onReleaseOutside”/>
<identifier text=”.onRollOut”/>
<identifier text=”.onRollOver”/>
<identifier text=”.pressFocus”/>
<identifier text=”.registerSkinElement”/>
<identifier text=”.setBtnState”/>
<identifier text=”.setChangeHandler”/>
<identifier text=”.setClickHandler”/>
<identifier text=”.setEnabled”/>
<identifier text=”.setHitArea”/>
<identifier text=”.setLabel”/>
<identifier text=”.setSize”/>
<identifier text=”.setStyleProperty”/>
<identifier text=”.txtFormat”/>
<identifier text=”.updateStyleProperty”/>
</colorsyntax>[/cc]