# Using the Delegate Class

**URL:** <https://forum.kirupa.com/t/using-the-delegate-class/242795>\
**Category:** flash\
**Created:** [October 30, 2007, 2:31pm UTC](https://forum.kirupa.com/t/using-the-delegate-class/242795 "2007-10-30T14:31:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![trundrumbalind](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/trundrumbalind/32/696_2.png) [@trundrumbalind](https://forum.kirupa.com/u/trundrumbalind)\
**Post date:** [October 30, 2007, 2:31pm UTC](https://forum.kirupa.com/t/using-the-delegate-class/242795/1 "2007-10-30T14:31:04Z")

</div>

Hi there,  
I’m having trouble using the delegate.create method (my first time using it!). Here’s part of a class I have…

```auto

public function SiteData(xmlFile:String) {    
        imagesXML = new XML();
        imagesXML.ignoreWhite = true;
        imagesXML.onLoad = function(ok) {
            var pictureURLS:Array = new Array();
            if (ok) {
                var myArray:Array = this.firstChild.childNodes;
                for (var i:Number = 0; i < myArray.length; i++) {
                    pictureURLS.push(myArray*.childNodes[0].childNodes[0]);
pictureCaptions.push(myArray*.childNodes[1].childNodes[0]);
                }

                if (!_root.builtStack) {
                    _root.builtStack = true;
                    Delegate.create(this, buildStack);
                }
            }
        };
        
        imagesXML.load("testGallery.xml");
    }
    
    public function buildStack() {
        trace("IN BUILDSTACK");
    }

```

But the Delegate.create line isn’t calling buildStack (and tracing out “IN BUILDSTACK”). Is it something to do with the Delegate.create declaration being in an XML’s onLoad??

Any help would be great.

Many thanks,  
Dave
