1 Reply Latest reply on Nov 20, 2009 5:16 AM by _Natasha_

    Error 1120 in flex Builder acces of undefined properties




      I try to crete a simple xml reader, but flex builder found a error 1120: acces of undefined properties


      Can anyone help me?


      This is the code

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="1024" minHeight="768">
                     import mx.collections.XMLListCollection;
                     import flash.xml.*;
                       import flash.net.*;
                       import flash.events.Event;
                     private var company:XML;     
                     private var xmlString:URLRequest ;
                     private var xmlLoader:URLLoader ;
                "err.1120"     xmlString = new URLRequest("data/data.xml");
                "err.1120"     xmlLoader= new URLLoader(xmlString);
                "err.1120"     xmlLoader.addEventListener("complete", initXml);
                "err.1120 initXml"     
                     private function initXml(event:Event):void{     
                           company = XML(xmlLoader.data);
                     private var companyData:XMLListCollection = new XMLListCollection(company.department);
                     private function treeLabel(item:Object):String
                          var node:XML = XML(item);
                          if( node.localName() == "department" )
                               return node.@title;
                               return node.@name;
           <mx:ApplicationControlBar x="0" y="0" width="1045">
           <mx:TabBar x="10" y="41" dataProvider="viewstack1">
           <mx:ViewStack x="10" y="62" id="viewstack1" width="259" height="738">
                <mx:VBox label="Database" width="100%" height="100%">
                <mx:VBox label="Categoria" width="100%" height="100%">
                     <mx:Tree id="tree" width="256" height="570" 
                <mx:HBox label="Search" width="100%" height="100%">
           <mx:DataGrid x="307" y="62" width="272.04547" height="569.3939">
                     <mx:DataGridColumn resizable="false" sortable="false"/>
                     <mx:DataGridColumn headerText="Column 2" dataField="User"/>
        • 1. Re: Error 1120 in flex Builder acces of undefined properties
          _Natasha_ Level 4

          private var xmlString:URLRequest = new URLRequest("data/data.xml"); 
                         private var xmlLoader:URLLoader = new URLLoader(xmlString);
                                  // this string you can write only in a function           xmlLoader.addEventListener("complete", initXml);

          for example add creationComplete="initApp()" to Application

          and add

          private function initApp():void


          xmlLoader.addEventListener("complete", initXml);