If the functions exist, and you have the names in the xml, you can use
bracket notation to resolve the references:

this[myFunction]();

 

Tracy

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Corey Smaller
Sent: Friday, May 09, 2008 5:14 PM
To: [email protected]
Subject: [flexcoders] calling different methods through XML and Flash
Proxy class?

 

ok, im a little confused. I need to be able to call many different
methods based on whatever comes in through the XML (ie- the XML would
have a "function" node that names a preexisting function to handle
whatever data comes in). My idea is to have one class that sends and
receives the XML (DatabaseRequest.as for example) and then calls
whatever function/class to set up the proper swf based on the XML
data. like this

<function>createVideoSection</function>

Instead of using a ton of if/then statements is there an easier way to
just call the function (even though the data comes in as XML) or
create a class that interprets it??

I read a few examples on the Proxy class and maybe i am going in the
right direction? its friday, Im tired, and its raining. 

from what I have read on the Proxy class you need to override
flash_proxy_function CallProperty like so (taken from livedocs):

//code 

override flash_proxy function callProperty(methodName:*, ... args):* {
var res:*;
switch (methodName.toString()) {
case 'clear':
_item = new Array();
break;
case 'sum':
var sum:Number = 0;
for each (var i:* in _item) {
// ignore non-numeric values
if (!isNaN(i)) {
sum += i;
}
}
res = sum;
break;
default:
res = _item[methodName].apply(_item, args);
break;
}
return res;
}

//end code

 

Reply via email to