you could use an event to listen to, to pass the XML out of the class.

On Jan 29, 2008 1:42 PM, Claudio M. E. Bastos Iorio <[EMAIL PROTECTED]>
wrote:

> Hi guys, hope you can help me on this one.
>
> I have a class to load an XML file. I'm trying this:
>
>
>
>
> package {
>   import flash.net.URLRequest;
>   import flash.net.URLLoader;
>   import flash.events.*;
>   public class retornaXML{
>      private var _xml:XML;
>      public function retornaXML() {
>         cargarXML();
>      }
>
>      private function cargarXML():void {
>         var loader:URLLoader = new URLLoader();
>         loader.addEventListener(Event.COMPLETE, xmlLoaded);
>         loader.load(new URLRequest("LocalData.xml"));
>      }
>      private function xmlLoaded(e:Event):void {
>         _xml = new XML(e.target.data);
>         trace(_xml);
> //THE TRACE HERE WORKS PERFECT AND RETURNS THE XML
>
>      }
>      public function get elXML():XML {
>         return _xml;
> //THIS RETURNS null
>      }
>
>   }
> }
>
>
>
> I want something like this:
>
>
>
> var mivariable:retornaXML = new retornaXML();
> trace(mivariable.elXML);
>
>
>
> but this trace returns null, since the xml file (I think) is not loaded
> yet.
> What should I do?
>
>
>
> Thanks in advance.
>
> ____________________________________________________
>
> Claudio M. E. Bastos Iorio
>
>  <http://www.blumer.com.ar/> http://www.blumer.com.ar
>
>
>
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to