1 Reply Latest reply on Feb 1, 2008 8:38 PM by ntsiii

    States inside a Repeater

    _shinya_
      hi all!

      i have this problem: i have a repeater component binded with an xml stream taken from a db.
      By now it displays a label and an image. What i wanna do is enlarge the current elements clicked by the user adding additional informations about the clicked product (all the informations are in that xml stream).
      The code i wrote is something like this:

      [code]
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Canvas xmlns:mx=" http://www.adobe.com/2006/mxml" creationComplete="dataRequest.send()"
      xmlns:flexlib=" http://code.google.com/p/flexlib/">

      <mx:HTTPService id="dataRequest" url=" http://localhost:8084/infoflex/SampleServlet"
      useProxy="false"
      method="GET">
      </mx:HTTPService>

      <mx:states>
      <mx:State name="itemExpanded">
      <mx:AddChild relativeTo="{itemBox}">
      <mx:Label text="Formato:"/> <mx:Label text="{listaMaterialeIstituz.currentItem.des_fmo}"/>
      </mx:AddChild>
      </mx:State>
      </mx:states>

      <mx:Script>
      <![CDATA[
      import mx.utils.StringUtil;
      ]]>
      </mx:Script>

      <mx:Panel title="Materiale Istituzionale" height="100%" width="100%">
      <mx:Label text="Il Materiale Istituzionale andra' qua!!"/>

      <mx:Repeater id="listaMaterialeIstituz" dataProvider="{dataRequest.lastResult.qresults.row}">
      <mx:HRule width="100%"/>

      <mx:HBox id="itemBox" click="currentState='itemExpanded'">
      <mx:Label text="{listaMaterialeIstituz.currentItem.des_mte_arc_fot}" width="80%" />
      <flexlib:Base64Image source="{StringUtil.trim(listaMaterialeIstituz.currentItem.img_bassa)}"/>
      </mx:HBox>
      </mx:Repeater>
      </mx:Panel>
      </mx:Canvas>
      [/code]

      But trying to compiling this i get the error: "Implicit coercion of a value of type Array to an unrelated type mx.core:UIComponent" at the line 12...namely <mx:AddChild relativeTo="{itemBox}">.

      What am i doing wrong here??

      thanks in advance!