1 Reply Latest reply on Sep 12, 2007 6:12 AM by *gsb*

    Binding server XML data to a repeater

    *gsb* Level 1


      I failed at making a successful repeater so I went to the docs to try again.

      This small example is out of the FLEX 2 docs:
      http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Live Docs_Book_Parts&file=repeater_078_06.html

      When I try it throws warnings as below just as my original attempt had done.

      Can someone explain why the warnings and a correct way to accomplish this task.
      I am still missing the big picture I think, but will get there with a little help.

      quote:

      <?xml version="1.0"?>
      <!-- repeater\DynamicLoop.mxml -->
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" initialize="catalogService.send()">

      <mx:HTTPService id="catalogService" url=" http://localhost/catelog.xml" resultFormat="e4x"/>

      <mx:XMLListCollection id="myXC" source="{catalogService.lastResult.product}"/>

      <mx:VBox horizontalAlign="center" width="100%" height="100%">
      <mx:Repeater id="r" dataProvider="{myXC}">
      <mx:RadioButton id="Radio" label="{r.currentItem.name}" width="150"/>
      </mx:Repeater>
      </mx:VBox>

      </mx:Application>

      [SWF] D:\FLEX\book1\bin\book1-debug.swf - 698,163 bytes after decompression
      warning: unable to bind to property 'product' on class 'XML' (class is not an IEventDispatcher)
      warning: unable to bind to property 'name' on class 'XML' (class is not an IEventDispatcher)
      warning: unable to bind to property 'name' on class 'XML' (class is not an IEventDispatcher)
      warning: unable to bind to property 'name' on class 'XML' (class is not an IEventDispatcher)
      warning: unable to bind to property 'name' on class 'XML' (class is not an IEventDispatcher)


      Thanks,

        • 1. Binding server XML data to a repeater
          *gsb* Level 1
          Hummm... no response before being pushed to Page 2.
          This is a bad sign I think.

          Well here is the best that I cam up with:

          quote:

          <?xml version="1.0"?>
          <!-- repeater\DynamicLoop.mxml -->
          <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml"
          initialize="catalogService.send()">

          <mx:Script>
          <![CDATA[
          import mx.collections.ArrayCollection;
          import mx.controls.Alert;

          [Bindable]
          private var myXC:ArrayCollection;
          ]]>
          </mx:Script>

          <mx:HTTPService id="catalogService"
          url="data/catalog.xml"
          result="myXC=event.result.products.product;"
          fault="Alert.show(event.fault.message);" />

          <mx:Repeater id="r" dataProvider="{myXC}" startingIndex="1">
          <mx:RadioButton id="Radio" label="{r.currentItem.name}"
          width="150"/>
          </mx:Repeater>

          </mx:Application>

          ...maybe it will help another.