Using the Delegate Class

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


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