I think some of the docs are obsolete. It appears to me that lines 4 and 5 aren't actually in a function definition, which means that they are in the static context of the surrounding class (you -are- putting this in a class, right? Flex doesn't support loose code.)
In that case, "request" does -not- exist, because its an instance var. Also, you need to make sure you have import flash.net.URLLoader; import flash.net.URLRequest; in your file somewhere. Also, I think that you'll need to add the COMPLETE event listener to loader.loadeeInfo rather than just loader. (I just hit this one myself!) -rg > -----Original Message----- > From: [email protected] > [mailto:[EMAIL PROTECTED] On Behalf Of revanisle > Sent: Monday, February 27, 2006 11:44 AM > To: [email protected] > Subject: [flexcoders] Newbie: load external xml problem > > Hi all, > I'm new to Flex and AS3 (well, I guess everyone's "new" to > AS3) and am having difficulty with what should be basic and > simple - loading an external xml file. I can't even get the > examples in Help to work (Flex 2beta): > > 1 var externalXML:XML; > 2 var loader:URLLoader = new URLLoader(); > 3 var request:URLRequest = new URLRequest("xmlFile.xml"); > 4 loader.load(request); > 5 loader.addEventListener(EventType.COMPLETE, onComplete); > 6 > 7 function onComplete(event:Event):Void{ > 8 var loader:URLLoader = URLLoader(event.target); > 9 externalXML = new XML(loader.data); > 10 trace(externalXML.toXMLString()); > 11 } > > This gives me an error at line 7 - Void is not a compile time > constant. > If I change that to lowercase void (or any other valid > constant) or remove the type declaration :Void altogether I > get two errors at lines > 4 and 5 telling me that "request" and "loader" are undefined > properties, even though they're defined immediately above. > What gives? and thanks in advance for your help! > > Rick Englert > > > > > > > -- > Flexcoders Mailing List > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > Search Archives: > http://www.mail-archive.com/flexcoders%40yahoogroups.com > Yahoo! Groups Links > > > > > > > -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

