PDA

View Full Version : Calling Functions from XML



dail
December 18th, 2007, 03:21 PM
Hi,

I'm building an XML accordion menu as an external class, and I want to be able to include a function reference in the external XML file, with the function body sitting in a class file. I want to be able to call that function say with a click on one of the menu items.

I've tried various approaches, but generally get type errors or a "Function Body" not supported error if I cast the XML data as a function.

Is there anyway to have a function call say, "testFunction" in an XML file, then with a click on a button, call that function which has its body sitting on say the main timeline?

Felixz
December 18th, 2007, 03:59 PM
hmm (target[functionname])();
It's just a quick try, don't know wheter this will work

dail
December 18th, 2007, 04:12 PM
Hi,

Thanks for the reply.

Trying that returns a "#1006: value is not a function." error. So maybe its something to do with the XML value being a string?

dail
December 18th, 2007, 04:44 PM
Well, thanks Felixz,

this works.

target[functionNameFromXML]()

Will call that function, wherever it may be.