flex - function name in xml and call this function -
i have functions , xml file in store name of functions , components..eg.
<commands> <command> <flexobject>myobject1</flexobject> <flexfunction>myfunction1</flexfunction> </command> <command> <flexobject>myobject2</flexobject> <flexfunction>myfunction2</flexfunction> </command> </commands>
i want make array of functions , call them..like as
arr:array = new array(); arr.push(myobject1.myfunction1); arr.push(myobject2.myfunction1); arr[0]();
call myobject1.myfunction1 function
myobjects , myfunctions classic component , functions
when call setcommandsservice.send <s:httpservice id="setcommandsservice" url="commands.xml" result="setcommandsservice_resulthandler(event)"/>
in handler name of function string , dont know how can add array function..
okay, need make sure objects , functions there, should possible using dynamic nature of actionscript:
var functions:array = []; for(var i:uint = 0, len:uint = xml.command.length(); i<len; i++) { if(this[xml.command[i].flexobject] && this[xml.command[i].flexobject][xml.command[i].flexfunction]) { functions.push(this[xml.command[i].flexobject][xml.command[i].flexfunction]); } }
this fill array direct references function, here need functions[i]()
call them. said, don't agree having xml know internal working of application. possible xml call outside, definite security issue. if anything, try abstract 'action' id parse in flex , flex knows do.
Comments
Post a Comment