The info is correct, but the audience is different. You have to
"flex-ify" code samples from the Programming ActionScript book because
they are written to generally be usable independent of the tool that you
use to compile them. One such flexification is that all statements in a
script block must be inside a function. 

hth,

matt horn
flex docs

> -----Original Message-----
> From: [email protected] 
> [mailto:[EMAIL PROTECTED] On Behalf Of g_vaccarezza
> Sent: Wednesday, September 27, 2006 1:41 PM
> To: [email protected]
> Subject: [flexcoders] Re: Loading External XML error
> 
> Thank you! That worked!
> How come the livedoc provides buggy info? Seems that the 
> loader has to be inside a function to work...
> 
> --- In [email protected] 
> <mailto:flexcoders%40yahoogroups.com> , "Bela Hajzer" 
> <[EMAIL PROTECTED]>
> wrote:
> >
> > --- In [email protected] 
> <mailto:flexcoders%40yahoogroups.com> , "grand_master_flash_x" 
> > <nick.velloff@> wrote:
> > >
> > > try this...
> > > 
> > > <mx:Button text="load xml" click="loadXML()"/>
> > > 
> > > <mx:Script>
> > > <![CDATA[
> > > private var externalXML:XML;
> > > private var loader:URLLoader = new URLLoader(); private var 
> > > request:URLRequest = new URLRequest("xmlFile.xml");
> > > 
> > > private function loadXML(): void
> > > {
> > > loader.load(request);
> > > loader.addEventListener(Event.COMPLETE, onComplete); }
> > > 
> > > private function onComplete(event:Event):void { var 
> loader:URLLoader 
> > > = URLLoader(event.target); externalXML = new XML(loader.data); 
> > > trace(externalXML.toXMLString()); } ]]> </mx:Script>>
> > > 
> > > 
> > > > <mx:Script> tag:
> > > > 
> > > > <mx:Script>
> > > > <![CDATA[
> > > > 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(Event.COMPLETE, onComplete); 
> 6.function 
> > > > onComplete(event:Event):void { 7.var loader:URLLoader = 
> > > > URLLoader(event.target); 8.externalXML = new XML(loader.data); 
> > > > 9.trace(externalXML.toXMLString());
> > > > 10.}
> > > > ]]>
> > > > </mx:Script>
> > > > 
> > > > I get a compiling time error at lines 4 and 5. It says:
> > > > 
> > > > Access to undefined property loader Acces to undefined property 
> > > > request Access to undefined property onComplete
> > > > 
> > > > :O Any ideas what this could be and how to solve it!?
> > > > 
> > > > Thanks!
> > > > Guille
> > > >
> > >Hi Guille,put
> > import flash.net.URLRequest
> > import flash.net.URLLoader
> > that should be fine
> > Bye Bela
> >
> 
> 
> 
>  
> 


--
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/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/flexcoders/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> 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/
 



Reply via email to