Wierd, I can't post anything... Tracy, what do you mean by instance variable? I tried: public var myLoader:URLLoader = new URLLoader(myXMLURL); But it didn't work.. Any ideas?
--- In flexcoders@yahoogroups.com, "Tracy Spratt" <[EMAIL PROTECTED]> 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 > > > > ________________________________ > > From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On > Behalf Of Charlie Griefer > Sent: Wednesday, May 21, 2008 4:44 PM > To: flexcoders@yahoogroups.com > Subject: Re: [flexcoders] How do I use URLLoader? > > > > http://livedocs.adobe.com/flex/3/langref/flash/net/URLLoader.html > <http://livedocs.adobe.com/flex/3/langref/flash/net/URLLoader.html> > > import flash.net.*; > > I'm pretty new to Flex as well, but having the docs bookmarked has > come in very handy on a number of ocassions so far :) > > http://livedocs.adobe.com/flex/3/langref/index.html > <http://livedocs.adobe.com/flex/3/langref/index.html> > > On Wed, May 21, 2008 at 1:37 PM, wild.katana <[EMAIL PROTECTED] > <mailto:wild.katana%40gmail.com> > wrote: > > I have this code: var myXML:XML = new XML(); > > var XML_URL:String = > > > "http://gdata.youtube.com/feeds/api/videos?vq=football+-soccer&orderby=p > ublished&start-index=11&max-results=10 > <http://gdata.youtube.com/feeds/api/videos?vq=football+-soccer&orderby=p > ublished&start-index=11&max-results=10> "; > > var myXMLURL:URLRequest = new URLRequest(XML_URL); > > var myLoader:URLLoader = new URLLoader(myXMLURL); > > myLoader.addEventListener("complete", xmlLoaded); > > > > function xmlLoaded(event:Event):void > > { > > myXML = XML(myLoader.data); > > trace("Data loaded."); > > } > > > > And I want to read the XML file into a XML object in Flex, so that I > > can access different elements of it easier. But it is throwing up two > > errors when I try to compile it: > > > > 1120: Access of undefined property myLoader. > > 1120: Access of undefined property xmlLoaded. > > > > What am I doing wrong? Do I need to import any special things first? I > > am still pretty new to Flex... > > > > > > -- > A byte walks into a bar and orders a pint. Bartender asks him "What's > wrong?" Byte says "Parity error." Bartender nods and says "Yeah, I > thought you looked a bit off." >