Hi Bevan,

Not sure exactly what might have been going wrong, but if that's all you
have in your file then it will fail.

This should work though, assuming you have a file called test.xml in the
same folder as the XMLTest.as:

XMLTest.as
************************************************************
package {

import flash.display.Sprite;
import flash.events.Event;
import flash.net.URLRequest;
import flash.net.URLLoader;
import flash.util.trace;

public class XMLTest extends Sprite {

var myXML:XML = new XML();
var XML_URL:String = "test.xml";
var myXMLURL:URLRequest = new URLRequest(XML_URL);
var myLoader:URLLoader = new URLLoader(myXMLURL);

public function XMLTest() {

myLoader.addEventListener("complete", xmlLoaded);

}

public function xmlLoaded(evtObj:Event) {
myXML = XML(myLoader.data);
trace("Data loaded.");
}
}
}

************************************************************

Spike

On 10/24/05, Bevan Christians <[EMAIL PROTECTED]> wrote:
>
> i have an arb question just on the side about a/s3 dont mean to hijack
> the thread
> but i'm kinda new....
>
> i have this code (saw it under examples in the manual)
>
> <code>
> public function xmlLoader()
> {
> var myXML:XML = new XML();
> var XML_URL:String = "http://localhost/flextest/data.xml";;
> var myXMLURL:URLRequest = new URLRequest(XML_URL);
> var myLoader:URLLoader = new URLLoader(myXMLURL);
> myLoader.addEventListener("complete", xmlLoaded);
>
> private function xmlLoaded(evtObj:Event)
> {
> myXML = XML(myLoader.data);
> trace("Data loaded.");
> }
>
> }
> </code>
>
> but on debug running i get the following error:
> TypeError: Error #2007: Parameter 'listener' must be non-null.
> can anyone point me in the direction i should look
> no spoonfeeding required :/
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>



--
--------------------------------------------
Stephen Milligan
Do you do the Badger?
http://www.yellowbadger.com

Do you cfeclipse? http://www.cfeclipse.org
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to