# Function Formatting

**URL:** <https://forum.kirupa.com/t/function-formatting/170201>\
**Category:** flash\
**Created:** [November 23, 2005, 5:28pm UTC](https://forum.kirupa.com/t/function-formatting/170201 "2005-11-23T17:28:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![misterpatrick](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@misterpatrick](https://forum.kirupa.com/u/misterpatrick)\
**Post date:** [November 23, 2005, 5:28pm UTC](https://forum.kirupa.com/t/function-formatting/170201/1 "2005-11-23T17:28:49Z")

</div>

I’m a little confused about formatting for functions. I have tried a couple things with the code below including putting it inside another function with no success.

I have an object that I am using for an XML array. I want to reaload the XML parsing using the new nameVariable, but the way this is set up I can’t seem to “functionize” the onLoad. What do I need to do to make this a function that can be called later on. I’m a little hazy with the whole object thing.

```auto

var text_obj:Object = new Object();
text_obj.xml = new XML();
text_obj.xml.ignoreWhite = true;
text_obj.xml.load("xml/" + nameVariable + "_copy.xml");
text_obj.xml.onLoad = function(success:Boolean):Void {
if (success) {
trace("Success");
parseXML();
} else {
trace ("error");
}
};

```
