Topic: Sony Dash load XML

Hello,

I am confused on how to get an external XML file to load.

I am using a cross domain policy file.

Is it required to use something like:

function receivedParameters(parameters) { myTextField.text = parameters.someParameterName;
}

Thanks for the help!

-J

Re: Sony Dash load XML

Well, there's nothing specific to the Sony Dash that doesn't also apply to Flash in general.

Loading XML is an asynchronous process - you create an XML object, you attach onLoad or onData handlers to it and call the load() or sendAndLoad() functions.  Sometime later, the handlers are called.

The big trick is maintaining scope, so that you can do something with the data returned.  Here's one way to do it:

class MyClass {

    function getData(url):Void {
        var x:XML = new XML();
        ((Object)x).__target = this;
        x.onLoad = function(success:Boolean):Void {
            this.__target.gotData(success,this);
        }
        x.load(url);
    }

    function gotData(success:Boolean,x:XML):Void {
        // do something with the data here
    }
}

Note that in the function "gotData", the scope is correct - "this" is the instance of MyClass, not the XML object.

Re: Sony Dash load XML

Thanks for the reply Duane.

I had an error in my "crossdomain.xml"

-J