1 Reply Latest reply on Feb 4, 2010 10:03 AM by Cr99

    xml binding errors

    Cr99 Level 1

      I am trying to get some xml parsed into different elements in my interface, but I am getting the following errors:

       

      warning: unable to bind to property 'width' on class 'XML' (class is not an IEventDispatcher)

      warning: unable to bind to property 'height' on class 'XML' (class is not an IEventDispatcher)

      warning: unable to bind to property 'link' on class 'XML' (class is not an IEventDispatcher)

      warning: unable to bind to property 'caption' on class 'XML' (class is not an IEventDispatcher)

      warning: unable to bind to property 'channel' on class 'XML' (class is not an IEventDispatcher)

      warning: unable to bind to property 'id' on class 'XMLList' (class is not an IEventDispatcher)

      warning: unable to bind to property 'refresh' on class 'XML' (class is not an IEventDispatcher)

       

      Here is a snippet from the xml file:

       

      <?xml version="1.0" encoding='UTF-8'?>
      <Top>
      <StaticImage id ="00">
           <caption>Static Image</caption>
           <link>http://www.mydomain.html</link>
      </StaticImage>
      
      <CubeFaces id="10">
         <channels>
           <channel id="0" height="1000" width="1000" refresh="1">
                <caption>Ch22</caption>
                <link>http://www.mydomain.html</link>
           </channel>
               <!-- etc. more channels defined.... -->
          </channels>
      </CubeFaces>
      
      <Background>
           <image></image>
      </Background>
      </Top>
      
      
      When I access the parent tags (e.g. channel.caption), I get the values. 
      But when I try to access elements definied inside a tag (e.g. channel.id), I get nothing.
      Seems like I am just messed up on the syntax somehow?
      
      
      Here is the code I'm using to process the xml file:

       

      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"

      creationComplete="xmlFeed.send()">

           <mx:Script>

      <![CDATA[

      // imports, etc here...

       

      [Bindable]

              private var dbURL:String = "http://localhost:8888/myproj/kiosk";

              [Bindable]

              private var fileContents:XML;

              private function processXML(event:ResultEvent):void {

              fileContents = event.result as XML;

              trace (fileContents);

              }

      ]]>

           </mx:Script>

       

      <mx:HTTPService id="xmlFeed" useProxy="false" method="GET" showBusyCursor="true" resultFormat="e4x"

      fault="UtilityTools.handleFault(event);" url="{dbURL}" result="processXML(event)"/>

      <mx:Accordion id="accordion">

       

              <mx:VBox label="Cube Faces">

                  <mx:Repeater id="xmlTags" dataProvider="{fileContents.CubeFaces.channels.channel}"> 

                  <mx:HBox width="100%">

                  <mx:Label text="ID"/>

                  <mx:TextInput text="{xmlTags.currentItem.id}" width="30"/> <!-- id doesn't work -->

                  <mx:Label text="Height"/>

                  <!-- etc more elements defined here -->

                  <mx:TextInput text="{xmlTags.currentItem.caption}" width="60"/> <!-- caption works -->

                  </mx:HBox> 

                  <mx:HBox paddingLeft="10">

                  <mx:Label text="Link"/>

                  <mx:TextInput text="{xmlTags.currentItem.link}"/>  

                  </mx:HBox>   

                  </mx:Repeater>

              </mx:VBox>

       

                <!-- etc. more elements defined here -->

               </mx:Accordion>

       

      </mx:Application>