Thank you, it worked. Now, could you tell me how to access the data from the myXML object? Say I wanted to display what's in the <logo> element in the XML file: <?xml version='1.0' encoding='UTF-8'?> <feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:gml='http://www.opengis.net/gml' xmlns:georss='http://www.georss.org/georss' xmlns:media='http://search.yahoo.com/mrss/' xmlns:yt='http://gdata.youtube.com/schemas/2007' xmlns:gd='http://schemas.google.com/g/2005'> <id>http://gdata.youtube.com/feeds/api/videos</id><updated>2008-05-22T01:57:19.392Z</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://gdata.youtube.com/schemas/2007#video'/> <title type='text'>YouTube Videos matching query: football -soccer </title> <logo>http://www.youtube.com/img/pic_youtubelogo_123x63.gif</logo>
Then how would I do this? Alert.show(myXML.feed.logo); Just returns as nothing... Thanks for your help Tracy! -Leighton --- In flexcoders@yahoogroups.com, "Tracy Spratt" <[EMAIL PROTECTED]> wrote: > > And IMPORTANT: do not initialize/set it when you declare it. You can > only initialize instance variables to simple values. Set its value > inside the function. > > > > public var _myLoader:URLLoader; //declare this outside of a function. > The leading underscore is just a convention > > public var _myXML:XML; //this too > > ... > > private function initUrlLoader():void { > > var XML_URL:String ="http://whatever <http://whatever/> "; > var myXMLURL:URLRequest = new URLRequest(XML_URL); > _myLoader = new URLLoader(myXMLURL); > _myLoader.addEventListener("complete", xmlLoaded); > > ... > > } > > > > function xmlLoaded(event:Event):void > { > _myXML = XML(_myLoader.data); > trace("Data loaded."); > } > > > > Tracy > > ________________________________ > > From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On > Behalf Of Tracy Spratt > Sent: Wednesday, May 21, 2008 8:42 PM > To: flexcoders@yahoogroups.com > Subject: RE: [flexcoders] Re: How do I use URLLoader? > > > > Declare the variable in the "instance" scope, that is, not inside a > function. That will make it available anywhere within the class > instance. In non-OO terms, you might call it a "global" variable, but > it is not really global, only global to the class instance, hence the > term "instance" variable. > > > > Tracy > > > > ________________________________ > > From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On > Behalf Of wild.katana > Sent: Wednesday, May 21, 2008 4:53 PM > To: flexcoders@yahoogroups.com > Subject: [flexcoders] Re: How do I use URLLoader? > > > > Do you mean something like this: > public var myLoader:URLLoader = new URLLoader(myXMLURL); > I tried it but it didn't work... What do you mean by instance variable? > > --- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> > , "Tracy Spratt" <tspratt@> wrote: > > > > myLoader needs to be an instance variable instead of a local one. > > > > > > > > Maybe the sencond will go away when the xmlLoaded function can > compile. > > > > > > > > Consider HTTPService instead, it is a bit simpler to use. > > > > > > > > Tracy > > > > >