Yes, when repeater instantiates components, it creates a array of ids
for each specific id, so each mySlider has an id mySlider[n] where n is
the index of the item.

 

The cleanest way to deal with this is to create a custom component
containing all the components and repeat that component.  Pass in a
reference to the entire currentItem into a typed setter function.

 

You will find that doing this simplifies repeater work immensely,
especially when you need to dispatch an event and access the
dataProvider item in the handler.  You will not need getRepeaterItem().

 

Tracy

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Merrill, Jason
Sent: Tuesday, February 12, 2008 12:46 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Databinding in component

 

In this test case below, why do I get a warning message for the mx:Label
that databinding may not be able to detect changes in the HSlider?  I'm
just trying to create labels that always shows the value of the
respective slider.  Since this is in a repeater, is it a conflict with
the way I assign id to the slider?  What's the preferred way to do this?

 

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> " layout="absolute"
applicationComplete="init()">
 <mx:Script>
  <![CDATA[
   
   import mx.collections.ArrayCollection;
   
   [Bindable]
   private var _dp:ArrayCollection = new ArrayCollection();
   private function init():void
   {
    _dp.addItem(1)
    _dp.addItem(2)
    _dp.addItem(3)
   }
  ]]>
 </mx:Script>
 <mx:Panel>
  <mx:Repeater id="sliderRepeater" dataProvider="{_dp}" >
   <mx:VBox>
     <mx:HSlider id="mySlider"/> 
     <mx:Label text="{mySlider.value}"/>
   </mx:VBox>
  </mx:Repeater>
 </mx:Panel>
</mx:Application>

 

Jason Merrill 
Bank of America 
GT&O L&LD Solutions Design & Development 
eTools & Multimedia 

Bank of America Flash Platform Developer Community 

 

 

Reply via email to