1 Reply Latest reply on Oct 14, 2009 1:38 PM by cputnam14

    Using a repeater to repeat a custom component

    cputnam14 Level 1

      I'm not sure why this isn't working or how to make it work.

      Here is my example


      My Main mxlm file


      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:cc="*" layout="absolute">
                  private var dp:Array = [1, 2, 3, 4, 5, 6, 7, 8, 9];
        <mx:Canvas x="227" y="72" width="420" height="223">
           <mx:VBox width="106" height="180" x="304" y="33">
                <mx:Repeater id="myRep" dataProvider="{dp}">
                     <cc:MyCan height="38"/>
           <mx:VBox width="106" height="180" x="10" y="33">
                <mx:Repeater id="myRep2" dataProvider="{dp}">
                     <mx:Canvas width="100" height="24">
                          <mx:Label x="10" y="3" text="{myRep2.currentItem}" width="80"/>
           <mx:Label x="10" y="7" text="Works"/>
           <mx:Label x="304" y="7" text="Doesn't Work"/>


      The component named MyCan


      <?xml version="1.0" encoding="utf-8"?>
      <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="100" height="24">
           <mx:Label x="10" y="3" text="{this.parentApplication.myRep.currentItem}" width="80"/>


      Basically I have a repeater with an array datasource that loops from 1 to 9 and displays it in a label. If I put the label in the main application it works fine. If I put it in a component and repeat that...i get 9,9,9,9,9, a bunch of times. Any ideas on how to handle this?


      Code wasn't showing up