List/ItemRenderer troubles

Hey,
I just submitted a bug here: http://bugs.adobe.com/jira/browse/SDK-24069 and thought I would see if the community had a workaround. Like always, I could just be missing something really basic. Thanks,
- e
Oh, the code (and playable swf) is posted at jira, but I'll reproduce it here (must use latest SDK build...).
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
         xmlns:s="library://ns.adobe.com/flex/spark"
         xmlns:mx="library://ns.adobe.com/flex/halo">
  <fx:Script>
    <![CDATA[
      [Bindable] public var itemRenderersHeight:int = 60;
    ]]>
  </fx:Script>
  <s:HGroup gap="20" y="100" x="100">
    <s:List id="myList" borderVisible="false">
      <!--<s:layout><s:VerticalLayout /></s:layout>-->
      <s:ArrayCollection>
        <fx:Object label="hello"  color="0xff0000" />
        <fx:Object label="cruel"  color="0x00ff00" />
        <fx:Object label="world!" color="0x0000ff" />
      </s:ArrayCollection>
      <s:itemRenderer >
        <fx:Component>
          <s:ItemRenderer width="100%" height="{myItemRenderersHeight}"
                  mouseOver="{myBorder.setStyle('backgroundAlpha',.8)}"
                  mouseOut="{myBorder.setStyle('backgroundAlpha', .5)}"
                  creationComplete="init()">
            <fx:Script>
              <![CDATA[
                import mx.binding.utils.BindingUtils;
                import mx.binding.utils.ChangeWatcher;
                [Bindable] public var myItemRenderersHeight:int = 60;
                protected function init():void {
                  myItemRenderersHeight = this.parentApplication.itemRenderersHeight;
                  var watcherSetter:ChangeWatcher =
                    BindingUtils.bindSetter(updateHeight, this.parentApplication, "itemRenderersHeight");
                public function updateHeight(val:int):void {
                  this.height = val;
              ]]>
            </fx:Script>
            <s:Border id="myBorder" width="100%" height="100%"
                  borderColor="green" borderWeight="2"
                  backgroundColor="{data.color}" backgroundAlpha=".5">
              <s:Label id="myLabel" text="{data.label}" verticalCenter="0" horizontalCenter="0" />
            </s:Border>
          </s:ItemRenderer>
        </fx:Component>
      </s:itemRenderer>
    </s:List>
    <s:Label height="{itemRenderersHeight}" width="100"
         text="height: {itemRenderersHeight}px" backgroundAlpha=".6" backgroundColor="black" color="white"
         verticalAlign="middle" textAlign="center"/>
    <s:NumericStepper stepSize="5" minimum="10" maximum="130" value="@{itemRenderersHeight}"/>
  </s:HGroup>
</s:Application>

grrrrr, super simple solution -- remove height/width properties of <s:ItemRenderer> and paste them into the <s:Border> class (the uicomponent wrapped by the itemrenderer). Also for a cleaner look, uncomment the list's layout property and set gap to -1.
my understanding is that <s:itemRenderer> (pay attention to case) is a factory class, which churns out the contents of <s:ItemRenderer> (a subclass of the Group UIComponent), so I'm confused why I can't set the dimensions directly on <s:ItemRenderer>.
Anyway, here is the fixed code:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
         xmlns:s="library://ns.adobe.com/flex/spark"
         xmlns:mx="library://ns.adobe.com/flex/halo">
  <fx:Script>
    <![CDATA[
      [Bindable] public var itemRenderersHeight:int = 60;
    ]]>
  </fx:Script>
  <s:HGroup gap="20" y="100" x="100">
    <s:List id="myList" borderVisible="false">
      <s:layout><s:VerticalLayout gap="-1"/></s:layout>
      <s:ArrayCollection>
        <fx:Object label="hello"  color="0xff0000" />
        <fx:Object label="cruel"  color="0x00ff00" />
        <fx:Object label="world!" color="0x0000ff" />
      </s:ArrayCollection>
      <s:itemRenderer >
        <fx:Component>
          <s:ItemRenderer initialize="init()">
            <fx:Script>
              <![CDATA[
                import mx.binding.utils.BindingUtils;
                import mx.binding.utils.ChangeWatcher;
                protected function init():void {
                  var watcherSetter:ChangeWatcher =
                    BindingUtils.bindSetter(updateHeight, this.parentApplication, "itemRenderersHeight");
                public function updateHeight(val:int):void {
                  myBorder.height = val;
              ]]>
            </fx:Script>
            <s:states>
              <s:State name="normal" />
              <s:State name="hovered" />
            </s:states>
            <s:Border id="myBorder" width="200"
                  borderColor="green" borderWeight="2"
                  backgroundColor="{data.color}"
                  backgroundAlpha=".5" backgroundAlpha.hovered=".9">
              <s:Label id="myLabel" text="{data.label}" verticalCenter="0" horizontalCenter="0" />
            </s:Border>
          </s:ItemRenderer>
        </fx:Component>
      </s:itemRenderer>
    </s:List>
    <s:Label height="{itemRenderersHeight}" width="100"
         text="height: {itemRenderersHeight}px" backgroundAlpha=".6" backgroundColor="black" color="white"
         verticalAlign="middle" textAlign="center"/>
    <s:NumericStepper stepSize="5" minimum="10" maximum="130" value="@{itemRenderersHeight}"/>
  </s:HGroup>
</s:Application>
- e

Similar Messages

  • Extending a component which already extends a spark list ItemRenderer

    Hello everyone,
    I have the following situation: Im displaying lists of very similar data objects (they extend the same parent) so in order to avoid a lot of changes to many itemrenderers (if i need to change something in the common properties) when displaying this data, i defined a spark list ItemRenderer (in MXML) which displays the common properties (file called BaseRenderer.mxml):
    <s:ItemRenderer>
         //in the script section i override the set data property
         //some MXML labels, checkboxes, etc
    </s:ItemRenderer>
    Then i created a specific itemrenderer which extended it (file SpecificRenderer.mxml):
    <model:BaseRenderer>
         //again i override the set data property
         //some ADITIONAL MXML labels, checkboxes, etc
    </model:BaseRenderer>
    When i run the app, and when the specific renderer is used, it works (no errors are thrown) , but it only shows the content of specific renderer, nothing from base renderer is visible. Is this the right way to do this, or do i have to override some additional stuff in my specific renderers?
    Thank you.
    One more thing, i just noticed, if i remove all MXML tags from specific renderer, the content from base renderer becomes visible, seems as if specific content overrides base content. Is there a way to add mxml tags into the specificrenderer?

    Yes i suspected them to be merged, and you gave me a great idea. As you say this behavior is true across all mxml defined components, not just itemrenderers. I want to avoid actionscript renderers because i dont (and wont) have any performance issues anyway and i like flexibility in design view, so instead i found another solution which i slightly modified. Some spark components inherit property mxmlContent, which you can override. This is what i came up with in the end: I added the property override into specific renderer and everything is shown as expected (because base elements are merged with the ones from extended component).
    override public function set mxmlContent(value:Array):void {
                                            var adding:Boolean = true;
                                            var index:int = 0;
                                            while (adding) {
        var element:IVisualElement = null;
        try {          element = super.getElementAt(index); } catch(e:Error) {          }
        if ( element != null )  {
           value.push(element);
           index += 1;
        else
          adding = false;
                                            value.reverse();
                                            super.mxmlContent = value;

  • Check class name of List ItemRenderer

    Hello,
    I am setting the itemRenderer of a Spark Mobile List like so:
    var ir:ClassFactory=new ClassFactory(MyItemRenderer);
    ir.properties={etc. etc.};
    list.itemRenderer=ir;
    How can I check if the list's itemRenderer is MyItemRenderer or at least a class name string comparison?
    Thank you.

    Custom itemRenderer:
    public class MyItemRenderer extends LabelItemRenderer {...}
    View:
    var ir:ClassFactory=new ClassFactory(MyItemRenderer);
    ir.properties={etc. etc.};
    list.itemRenderer=ir;
    trace(ClassFactory(list.itemRenderer).generator);
    That outputs: [Class LabelItemRenderer].

  • Return data from spark list itemrenderer

    Does anybody no how to return data from the itemrender for a spark list. say i had a checkbx in my itemrenderer how can I get that info back to my main component if its selected or not. I looked at datagrid and itemeditor but I really rather use a spark list. Thanks

    thanks I also found another way to doing it. A click handler on my list when that fires I can check if checkbx has been selected by doing event.target.document.mycheckBx.selected this will not work if using currentTarget cause it take the info from the itemRenderer. Now I understand the difference between currentTarget and target.
    not sure if this is a better way to access the data I think I might still just dispatch a event and do it your way.
    Its weird that mx:list has a editItemRenderer  and s:list does not
    thanks again TK

  • Spark List Itemrenderer items outside of List

    I have a spark list and i want some of the items in it to appear out side of the list depending on the users interaction.
    Is there a way to make items of an item renderer appear outsid of the LIst container?
    When i use basic layout on the lsit and explicitly set the x and y, they appear behind the list.
    Thanks.

    Hi jmandawg,
    My ListRenderer.mxml may be what you want as follows,
    <?xml version="1.0" encoding="utf-8"?>
    <s:ItemRenderer 
    xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="
    library://ns.adobe.com/flex/spark" xmlns:mx="
    library://ns.adobe.com/flex/mx" hide="mOut(
    null)" mouseMove="mOut(event)" mouseOut="mOutValueItem(event)"mouseDownOutside="mOut(event)" creationComplete="inited()"
    autoDrawBackground="
    true">
    <fx:Script>
    <![CDATA[
    import mx.controls.TextInput; 
    import mx.managers.PopUpManager; 
    import mx.utils.StringUtil; 
    import flash.text.TextLineMetrics; 
    public var mouseOnPopup:Boolean = false;  
    public var vi:mx.controls.TextInput; 
    private function inited():void {vi =
    new mx.controls.TextInput();vi.editable=
    false;vi.addEventListener(MouseEvent.MOUSE_OUT, mOut);
    vi.addEventListener(MouseEvent.ROLL_OUT, mOut);
    vi.addEventListener(MouseEvent.MOUSE_OVER, mOverPopup);
    private function mOut(event:MouseEvent):void { 
    if ( vi.isPopUp ) {PopUpManager.removePopUp(vi)
    mouseOnPopup =
    false;}
    private function mOverPopup(event:MouseEvent):void {mouseOnPopup =
    true;}
    private function mOutValueItem(event:MouseEvent):void { 
    if ( vi.isPopUp && !mouseOnPopup) {PopUpManager.removePopUp(vi)
    private function mOver(event:MouseEvent):void { 
    var txt:String = itemValue.texttxt = StringUtil.trim(txt);
    if(txt.length<5) return; 
    if(!vi.isPopUp) {PopUpManager.addPopUp(vi,
    this.parent)vi.text=txt;
    vi.setStyle(
    'fontSize',18); 
    var txtMetrics:TextLineMetrics = vi.measureText(vi.text);vi.width=txtMetrics.width*1.2
    vi.height=itemValue.height*1.4
    var p:Point = itemValue.localToGlobal(new Point(itemValue.x, itemValue.y));vi.x=p.x;
    vi.y=p.y-10;
    ]]>
    </fx:Script>
    <s:TextInput id="itemValue" text="{data.value}" width="200" mouseOver="mOver(event)" mouseOut="mOutValueItem(event)" mouseMove="mOut(event)" editable="false"/> 
    </s:ItemRenderer>
    You may test it with the following in your main.mxml
    Bindable] 
    private var detailAC:ArrayCollection = new ArrayCollection([{value:"nteDevice.device"},{value:
    "nteDevice.deviceTypenteDevice.loopbackIpAddr"},{value:
    "nteDevice.ipAddressnteDevice.loopbackIpAddr"},{value:
    "nteDevice.loopbackIpAddrnteDevice.loopbackIpAddr"}, {value:
    "nteDevice.release"},{value:
    "nteDevice.releasenteDevice.loopbackIpAddr"},{value:
    "nteDevice.clli"},{value:
    "nteDevice.provisionStatus"}]);
     <s:List id="lst" itemRenderer="com.att.ntscp.view.component.ListRenderer" dataProvider="{detailAC}" width="200" height="200"/>
    Is it a little bit trick?
    Jeffrey

  • Suggested workaround for list itemrenderer bug?

    Can someone point me in the right direction for a workaround for the problem described as Flex bug 28191:
    https://bugs.adobe.com/jira/browse/SDK-28191
    Steps to reproduce:
    1. Populate a Tree/List with data and provide a custom itemRenderer class factory.
    2. Change the class factory and dataProvider at the same time.
    3. List.createItemRenderer() will crash during since Factory is the key and it has been changed.
                    delete freeItemRenderersByFactory[factory][renderer];
    Actual Results:
    Crash because the renderer can not be found since it does not exist on that factory dictionary since the class factory was changed and the lookup is using the new factory.
    Expected Results:
    Not crash.
    Seems like a race condition, as sometimes during this process it skips that block of code but in other cases it falls into this block and fails.
    I need to change the data provider and item renderer of a tree control at runtime. Is there one or more methods I should run to prevent this? As the bug notes state, this is an intermittent problem. The error occurs here:
    if (factory == itemRenderer)
                if (freeItemRenderers && freeItemRenderers.length)
                    renderer = freeItemRenderers.pop();
                    delete freeItemRenderersByFactory[factory][renderer];

    Thanks. Actually, I have been updating (not setting or changing) the tree's dataprovider, and then changing the classFactory like this:
    processesXML = event.result as XML;
    nodeTreeData.source = processesXML.children();
    if (treeMultiSelect)
    nodeTree.itemRenderer=new ClassFactory(renderers.TreeItemRendererV1);
    nodeTree.allowMultipleSelection = true;
    nodeTree.setStyle("selectionColor", "0xFFFFFF");
    nodeTree.setStyle("disclosureOpenIcon", MinusIcon);
    nodeTree.setStyle("disclosureClosedIcon", PlusIcon);
    else
    nodeTree.itemRenderer=new ClassFactory(mx.controls.treeClasses.TreeItemRenderer);
    nodeTree.allowMultipleSelection = false;
    nodeTree.setStyle("selectionColor", "0x7FCEFF");
    nodeTree.setStyle("disclosureOpenIcon", OpenArrowIcon);
    nodeTree.setStyle("disclosureClosedIcon", ClosedArrowIcon);
    I had tried using validateNow after changing the ClassFactory before but did get the error again. I will try it again but update the data provider after. Since it's an intermittent error I'm finding it hard to know if a fix is really working.

  • List component trouble

    Hello!
    I have some trouble with the list component in my
    application. The thing is that the keyboard interaction don't work
    proper. I've found out that it is my function "transferParameters"
    who spoils it. The function looks like this:
    Object.prototype.transferParameters = function(ref)
    var i;
    for(i in this)
    ref[ i ] = this[ i ];
    I am using the function to duplicate objects without making
    the instances refer to each other.
    What should I do to get the keyboard interaction to work?
    Regards Toben

    Nope that doesn't seem to solve the problem. I tried putting
    the listListener function and all the variable definitions outside
    of the onData, but still have the same problem! Is there a thing
    with the List component that you have to click into them before
    they're activated or something? Or might it be something with
    Firefox? It works almost all the time in IE.
    Thanks,
    Mukul

  • Dynamic height of mx:Text in List ItemRenderer

    Hello,
    I want to have a list with line breaks if the width of the
    items is higher then the width of the list.
    I wrote my custon ItemRender but if i set the no height to
    the mx:Text there would be only first line tdisplayed on the list
    My List looks like this
    <mx:List id="level1" dataProvider="{level1List}"
    width="100%" height="100%"
    change="selectLevel1ItemEvent(event)">
    <mx:itemRenderer>
    <mx:Component>
    <mx:VBox height="100%">
    <mx:Text width="100%" height="40" text="{data.desc}"/>
    </mx:VBox>
    </mx:Component>
    </mx:itemRenderer>
    </mx:List>
    The problem is that know all items have a height to fit an
    item with two lines. I want only have this if the width of an item
    is higher than the width of the list.
    Thanks,
    Stefan

    try setting minHeight of the RTE to 0

  • Flex List ItemRenderer : Change States from parent ?

    Hai there,
    So i created a list that uses an arrayCollection as dataProvider and an itemRenderer with 2 states : LabelState and ProgressState, the labelState is the start state and shows a Filename, the progressState is the state i need to change to when i press a "Start Upload" Button.
    This is the itemrenderer :
    <?xml version="1.0" encoding="utf-8"?>
    <s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:s="library://ns.adobe.com/flex/spark"
    xmlns:mx="library://ns.adobe.com/flex/mx"
    autoDrawBackground="true" currentState="LabelState" width="800">
    <s:states>
    <s:State name="LabelState" />
    <s:State name="ProgressState" />
    </s:states>
    <fx:Declarations>
    <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
    <fx:Script>
    <![CDATA[
    public function changeState():void
    trace("changing state for " + label_field.text);
    this.currentState = "ProgressState";
    trace(this.currentState);
    ]]>
    </fx:Script>
    <s:Label name="label_field" paddingLeft="10" maxHeight="40" paddingTop="10" paddingBottom="10" id="label_field" width="800" color="#333333" includeIn="LabelState" text="{data.label}"/>
    <mx:ProgressBar id="progress_field" left="3" top="3" bottom="3" mode="manual" chromeColor="#0096FF" includeIn="ProgressState" textAlign="center" labelPlacement="center" maximum="100" color="#FFFFFF" right="3"/>
    </s:ItemRenderer>
    This is the code for the List :
    <s:List keyUp="lst_selected_files_keyUpHandler(event)" skinClass="styles.skins.ListSkinNoHorizontal"
    borderVisible="false"
    contentBackgroundColor="#c9c9c9" contentBackgroundAlpha="1"
    id="lst_selected_files"
    width="100%" height="100%"
    alternatingItemColors="[#EAEAEA,#FAFAFA]" color="#000000"
    itemRenderer="components.ProgressLabel" dataProvider="{arr_items}" />
    <components:RemoveBar nr_of_items="{arr_items.length}" id="cmp_removeBar" hermesRYA="cmp_removeBar_hermesRYAHandler(event)" bottom="-35" width="100%" height="35" />
    This is the function that changes the states for the current "to be uploaded file":
    protected function uploadNextFile():void
    if(uploadingFile!=null) uploadingFile==null;
    popup = null;
    popup = new ProgressPanel();
    lst_selected_files.selectedIndex = currentUploadNr;
    current_progressItem = lst_selected_files.dataGroup.getElementAt(currentUploadNr) as ProgressLabel;
    current_progressItem.changeState();
    lst_selected_files.validateNow();
    For some reason the states change ... but the elements aren't visually updated, ... meaning that i still see the label and the progressbar isn't visible :/
    anyone ?

    This seems to work for me:
    <s:Application
        xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:mx="library://ns.adobe.com/flex/mx" >
        <s:controlBarContent>
            <s:Button label="test" click="(list1.dataGroup.getElementAt(0) as Object).test()" />
        </s:controlBarContent>
        <s:List id="list1">
            <s:dataProvider>
                <s:ArrayList>
                    <fx:Array>
                        [0,1,2]
                    </fx:Array>
                </s:ArrayList>
            </s:dataProvider>
            <s:itemRenderer>
                <fx:Component>
                    <s:ItemRenderer>
                        <fx:Script>
                            <![CDATA[
                                public function test():void {
                                    currentState = 'state2';
                            ]]>
                        </fx:Script>
                        <s:states>
                            <s:State name="state1" />
                            <s:State name="state2" />
                        </s:states>
                        <s:Rect width="50" height="50">
                           <s:fill>
                               <s:SolidColor color.state1="red" color.state2="green" />
                           </s:fill>
                        </s:Rect>
                        <mx:ProgressBar includeIn="state2" />
                    </s:ItemRenderer>
                </fx:Component>
            </s:itemRenderer>
        </s:List>
    </s:Application>
    You will probably want to override getCurrentRendererState() to do this properly tho.  This post demonstrates how to use DataRenderer instead if you would rather: http://flexponential.com/2010/02/07/using-datarenderer-to-add-custom-states-to-a-spark-lis t-renderer/
    In general you shouldn't interact with the renderers of a List directly (via getElementAt), but rather by changing the data in the List and building an ItemRenderer that reacts to those changes.  So it would be better if you did something like list1.dataProvider.getItemAt(0).changeState = true and then in your renderer override the data setter to change the state if that variable is set.

  • List ItemRenderer contains old values

    Hi Everyone,
         I have used List for show the data from db. Data will update periodically. My problem is some rows contains old values. I have tried validateNow(), invalidateList...
    But I cant achieve the result.
    Kindly Suggest me the possible ways to reset the Data.
    Thanks in Advance.
    Arun P. Ganesh

    If you are using custom ItemRenderer, you need to declare a variable within custom ItemRenderer and use that variable to display the data.

  • List itemRenderer text position

    Hello!
    I have a list as depicted in the attached file.
    The Image container has a max with and max height set to 100 and maintain the aspect ratio.
    The first 10 are 100x75 because they are wide and it all looks good.
    However, the last one which is square and so 100x100, overlaps the text.
    If I was to set the text y right after the image ends, it would look bad for the first 10 images as the space would be too large.
    I tried setting the text y to be imageContainer.contentHeight, but that doesn't work.
    What would you do?
    Thanks!

    hi,
    Here is a test app you can use to load images and 'play' with the renderer.
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
       xmlns:s="library://ns.adobe.com/flex/spark"
       xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
    <fx:Script>
    <![CDATA[
    import mx.controls.Image;
    import spark.events.IndexChangeEvent;
    import mx.managers.DragManager;
    import mx.events.DragEvent;
    import mx.events.EffectEvent;
    import mx.events.FlexEvent;
    import mx.collections.ArrayCollection;
    [Bindable] private var ImageCollection: ArrayCollection = new ArrayCollection();
    private var fl:FileReferenceList=new FileReferenceList();
    private var fr:FileReference = new FileReference();
    private var ImageCount: int; 
    private var ImageLoop : int;
    private function loadImages(): void
    fl.addEventListener(Event.SELECT, selectedImages);
    var imagesFilter:FileFilter = new FileFilter("Images", "*.jpg;*.gif;*.png");
    fl.browse([imagesFilter]);
    private function selectedImages(e:Event): void
    fl.removeEventListener(Event.SELECT, selectedImages);
    ImageCount = fl.fileList.length;
    ImageLoop  = 0;
    loopList(0);
    private function loopList(value:int): void
    if (value < ImageCount)
    fr = fl.fileList[value];
    fr.addEventListener(Event.COMPLETE,getImage);
    ImageLoop = ImageLoop+1;
    fr.load();
    else
    imgList.dataProvider = null;
    imgList.dataProvider = ImageCollection;
    private function getImage(e:Event): void
    fr.removeEventListener(Event.COMPLETE, getImage);
    if (fr.data.length > 0)
    var newData:Object = {
    img: fr.data,
    lbl: fr.name
    ImageCollection.addItem(newData);
    loopList(ImageLoop);
    ]]>
    </fx:Script>
    <s:List id="imgList" x="116" y="76" width="835" height="542" dataProvider="{ImageCollection}" itemRenderer="ImageRender">
    <s:layout>
    <s:TileLayout horizontalGap="3" verticalGap="3"/>
    </s:layout>
    </s:List>
    <s:Button x="116" y="35" label="Button" click="loadImages()"/>
    </s:Application>

  • Capture click on element inside List itemRenderer

    Hello!
    I have a List that opens a window when an element is selected.
    However, I also have a "delete" image in the upper-right corner of the itemRenderer componenet that when clicked should do something else.
    How can I make it so that when user clicks on the image the click doesn't select the list element, and when the user click anywhere else, it defaults to selecting the element in the list.
    Thank you!

    Yeah, I did that right after posting and the problem was that the List select event dispatched on MouseDown NOT on click and I was listening for Click on the image which never happened as the MouseDown came first and opened another window.
    Is there any easy way to setting the selection of elements in a list to be Click rather than MouseDown?
    If not, I will just listen for MouseDown on the image.

  • List ItemRenderer access multiple data

    I have a list component with a itemRenderer. The renderer has two label compoenents. Imagine the data provider has 4 objects like a,b,c,d.
    I want to display the data in the label components like this 'a' in the first label component and 'b' in the second label component.
    Means, I want to access the next data item in each iteration in the itemRenderer.
    Any help will be appriciated.
    Thanks
    Gan

    This trick is creating a second, empty, ArrayCollection which is databound to the drop-enabled list.  When you want to do anything to the items in that list, you simply work with that 2nd ArrayCollection.  Heres some code:
    <?xml version="1.0"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"   xmlns:ns1="*">
    <mx:Script>
    <![CDATA[
    import mx.collections.ArrayCollection;
    [Bindable]
    private var ac:ArrayCollection = new ArrayCollection([
    {restaurant: 'Restaurant 1'},
    {restaurant: 'Restaurant 2'},
    {restaurant: 'Restaurant 3'},
    {restaurant: 'Restaurant 4'}
    [Bindable]
    private var ac2:ArrayCollection = new ArrayCollection();
    private function removeSelected():void{
        ac2.removeItemAt(chosenList.selectedIndex);
    ]]>
    </mx:Script>
    <mx:DataGrid dataProvider="{ac}" dragEnabled="true">
        <mx:columns>
            <mx:DataGridColumn headerText="Restaurant" dataField="restaurant"/>
        </mx:columns>
    </mx:DataGrid>
    <mx:DataGrid id="chosenList" dataProvider="{ac2}" dropEnabled="true">
        <mx:columns>
            <mx:DataGridColumn headerText="Restaurant" dataField="restaurant"/>
        </mx:columns>
    </mx:DataGrid>
    <mx:Button label="Remove Selected" click="removeSelected()"/>
    </mx:Application>
    Hope this helps.
    Joe

  • A List ItemRenderer customization ?

    Hi
    I'm using a custom item renderer in two places of the application in LIST control, both accept same data and displays same info.
    Now i want to set some visual properties in one of the List Control, without chaning the code of the ItemRenderer. How can i do that?
    Is there any ItemFunction or ItemRendererFunction for list control? so i could display one of the List's item in Black and second in White [default]
    Thanks.

    <mx:List>
    <mx:itemRenderer>
         <item:item color="white"/><!-- item is the namespace and item is the class in the namespace -->
    </mx:itemRenderer>
    </mx:List>
    You can do something like above rite?? where color is the property in the item renderer.

  • Neither of my iPods will connect to iTunes.. iTunes recognizes that there's an iPod for each.. but that it can't open it in iTunes..  they were both connecting fine prior to the last update. went through the list of trouble shooting.

    Since the last update, I iTunes pops up with an error message when I connect both iPods.. the older Nano (4th or 5th generation) will show up as a dirve on Windoes.. but the new Nano (the latest generation) will show up as a dirve until the error message pops up on itunes.. then it dissapearsll.. and both get the same error message..  that itunes detects an ipod, but it can not be identified properly.. it suggest I unplug and replug. (done that several times) or the uninstall and reinstall iTunes (won't work either) .. and the trouble shooting isn't changing anything.
    They both worked fine before the last update

    Since the last update, I iTunes pops up with an error message when I connect both iPods.. the older Nano (4th or 5th generation) will show up as a dirve on Windoes.. but the new Nano (the latest generation) will show up as a dirve until the error message pops up on itunes.. then it dissapearsll.. and both get the same error message..  that itunes detects an ipod, but it can not be identified properly.. it suggest I unplug and replug. (done that several times) or the uninstall and reinstall iTunes (won't work either) .. and the trouble shooting isn't changing anything.
    They both worked fine before the last update

Maybe you are looking for

  • Email removed from inbox

    I am having an issue with one of my email accounts where email are being removed from inbox automatically.  They go to the inbox and then they just disappear.  If i forward the email to another user the mail is not deleted.... Any ideas?

  • Logic missing some patches

    I bought and downloaded Logic Pro. Some of the patches seem to be missing something. Half the notes on the keyboard DO NOT WORK.  Its like all the elements that make up some of the patches did not complete. Of all the sounds in the app, I think I hav

  • Eligibility email

    Where can i send the proof of student eligibility to the French store?

  • Trying to repair a Time Machine sparsebundle

    I am trying to repair a Time Machine sparsebundle file. However I am getting errors at the first step of trying to attach the image. hdiutil attach -nomount -noverify -noautofsck -verbose /Volumes/ReadyNAS/RobertsiMac.sparsebundle Initializing- CBSDB

  • Check for Downloads on iTunes??

    When I try to check for downloads on iTunes, it gives me a message that says, "The iTunes store is temporarily unavailable. Please try again later." I've emailed an Apple support person who checked with iTunes and determined that the problem is linke