This should work (havent compiled, so might have a typo or two).

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2005/mxml";
        creationComplete="onCreationComplete()">

    <mx:Script><![CDATA[
        import mx.formatters.*;
        [Bindable]

        var myXML:XML;
        var XML_URL:String

        private function onCreationComplete():Void
        {
                myXML = new XML();
                XML_URL = "data.xml";
                myXMLURL = new URLRequest(XML_URL);
                var myLoader:URLLoader = new URLLoader(myXMLURL);
                myLoader.addEventListener("complete", xmlLoaded);
        }

        function xmlLoaded(evtObj:Event) {
          myXML = XML(myLoader.data);
          trace("Data loaded.");
        }
       ]]>
   </mx:Script>
</mx:Application>

mike chambers

[EMAIL PROTECTED]



Merrill, Jason wrote:
I'm trying to load in an XML file in Flexbuilder 2, but I get errors. My file "data.xml" is in the same folder as "test1.mxml".
The errors are:

Access of undefined property myLoader   test1.mxml      test1   line 11
Access of undefined property xmlLoaded test1.mxml       test1   line 12

Here is the script test1.mxml:

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2005/mxml";>

    <mx:Script><![CDATA[
        import mx.formatters.*;
        [Bindable]

        var myXML:XML = new XML();
        var XML_URL:String = "data.xml";
        var myXMLURL:URLRequest = new URLRequest(XML_URL);
        var myLoader:URLLoader = new URLLoader(myXMLURL);
        myLoader.addEventListener("complete", xmlLoaded);

function xmlLoaded(evtObj:Event) { myXML = XML(myLoader.data);
          trace("Data loaded.");
        }
       ]]>
   </mx:Script>
</mx:Application>

Any idea what I am doing wrong?  I followed the examples in the docs.
Thanks.

Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com



NOTICE:
This message is for the designated recipient only and may contain privileged or 
confidential information. If you have received it in error, please notify the 
sender immediately and delete the original. Any other use of this e-mail by you 
is prohibited.
_______________________________________________
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