2 Replies Latest reply on Aug 2, 2010 10:16 PM by BhaskerChari

    Loading external XML getting 1120 error

    dudemcgrude

      First off im definately a Flex 4 noob and still have much to learn with AS3.  I have been searching the forums and google for a few hours now and I am officially stuck. 

       

      From what I can tell I have the correct setup to load and external xml file, but I get stuck with the following errors for the code below:


      1120: Access of undefined property imgXMLLoader.    tnssmenu.mxml    /tnssmenu/src    line 15    Flex Problem
      1120: Access of undefined property imgXMLLoader.    tnssmenu.mxml    /tnssmenu/src    line 16    Flex Problem
      1120: Access of undefined property processXML.    tnssmenu.mxml    /tnssmenu/src    line 16    Flex Problem

       

       

      <?xml version="1.0" encoding="utf-8"?>
      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
                        xmlns:s="library://ns.adobe.com/flex/spark" 
                        xmlns:mx="library://ns.adobe.com/flex/mx" 
                        height="270" width="970"
                        creationComplete="init()">
           <fx:Declarations>
                <!-- Place non-visual elements (e.g., services, value objects) here -->
           </fx:Declarations>
           
           <fx:Script>
                <![CDATA[
           
                     private var imgXMLLoader:URLLoader = new URLLoader();
                     imgXMLLoader.load(new URLRequest("http://www.mywebsite.com/bin-release/images/images.xml"));
                     imgXMLLoader.addEventListener(Event.COMPLETE, processXML);
                     
                     private function processXML(e:Event):void{
                          var imgXML:XML = new XML (e.target.data);     
                     }
                     
                     private function init():void {
                          img.load("");
                     }
                     
                ]]>
           </fx:Script>
           
           <mx:Image id="img" horizontalCenter="0" verticalCenter="0"/>
           <mx:Image source="assets/tnflashmenuborder.png" />
           
      </s:Application>
      
      

       

      one thing to note is that I changed the URL for the external XML, but I can assure you my path is correct and can load it from a web browser.  If this really matters Ill make the changes.  Help or a link to a proper tutorial would be fantastic, I appreciate the help!

        • 1. Re: Loading external XML getting 1120 error
          BhaskerChari Level 4

          Hi ooweeoo,

           

          Move the two lines in the init() which loads your xml into the init() function....

           

          Try to use the code below and check....and let me know if the problem still exists..

           

           

          <?xml version="1.0" encoding="utf-8"?>
          <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                            xmlns:s="library://ns.adobe.com/flex/spark"
                            xmlns:mx="library://ns.adobe.com/flex/mx"
                            height="270" width="970"
                            creationComplete="init()">
               <fx:Declarations>
                    <!-- Place non-visual elements (e.g., services, value objects) here -->
               </fx:Declarations>
              
               <fx:Script>
                    <![CDATA[
              
                         private var imgXMLLoader:URLLoader = new URLLoader();
                        
                         private function processXML(e:Event):void{
                              var imgXML:XML = new XML (e.target.data);    
                         }
                        
                         private function init():void {
                             img.load();
                          imgXMLLoader.load(new URLRequest(http://www.mywebsite.com/bin-release/images/images.xml));
                          imgXMLLoader.addEventListener(Event.COMPLETE, processXML);
                         }
                        
                    ]]>
               </fx:Script>
              
               <mx:Image id="img" horizontalCenter="0" verticalCenter="0"/>
               <mx:Image source="assets/tnflashmenuborder.png" />
              
          </s:Application>

           

           

          Thanks,

          Bhasker Chari

          • 2. Re: Loading external XML getting 1120 error
            dudemcgrude Level 1

            Thank you so much BhaskerChari!

             

            This definately got rid of the error and I believe ill be able to finally work with the xml data.  I really appreciate it!