# Calling Functions from XML

**URL:** <https://forum.kirupa.com/t/calling-functions-from-xml/247127>\
**Category:** flash\
**Created:** [December 18, 2007, 8:21pm UTC](https://forum.kirupa.com/t/calling-functions-from-xml/247127 "2007-12-18T20:21:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dail](https://avatars.discourse-cdn.com/v4/letter/d/82dd89/32.png) [@dail](https://forum.kirupa.com/u/dail)\
**Post date:** [December 18, 2007, 8:21pm UTC](https://forum.kirupa.com/t/calling-functions-from-xml/247127/1 "2007-12-18T20:21:47Z")

</div>

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?
