9 Replies Latest reply on Sep 13, 2006 8:23 AM by webSlinger

    Repeater with XML

      I need a little help with the repeater object. I'm using it to create a dynamic number of images... the images are getting their source string from XML, but I'm not sure how to reference the child node.

      I've got a HTTPService using php to run a query against a mysql database. Here's an example of how the output will look.

      $Return = "<phoneimgs>";
      while ( $PhoneType = mysql_fetch_object( $Result ) ) {
      $Return .= "<phoneimg><phonetype>".$PhoneType->phonetype."</phonetype><phoneimgsmall>".$PhoneType->p honesrcsmall."</phoneimgsmall><phoneimglarge>".$PhoneType->phonesrclarge."</phoneimglarge> </phoneimg>";
      $Return .= "</phoneimgs>";

      So it goes "phoneimgs" as root then "phoneimg" then "phoneimgsmall", which holds the URL for my jpgs.

      I've got an HTTPSevice calling the php script. The service's id is "imageRequest". Here's my ArrayCollection.

      <mx:ArrayCollection id="myAC" source="{ArrayUtil.toArray(imageRequest.lastResult.phoneimgs.phoneimg)}" />

      Here's the part I'm confused about. I've placed "????" in the spot where I assume I need to reference the "phoneimgsmall" child which contains the source URL.

      <mx:Repeater id="myrep" dataProvider="{myAC}">
      <mx:Image source="{myrep.currentItem.?????}" showEffect="{imgFade}" hideEffect="{imgFadeOut}" />

      Can anyone help? This would be easy if I was using the ArrayCollection for a datagrid. Then I could just set the "dataField" attribute of a column to "phoneimgsmall". Unfortunately the IMAGE object doesn't have anything that simple ;)