I have a column that contains an image.  The editor for it is a combobox
that lets you pick an image from the list of images in an arraycollection.
I want to have it where as soon as they click on the image from the
dropdown, the combobox disappears completely and changes are posted to the
original object.  Is there a single recommended way to do this?  Here's what
I've come up with:

<mx:itemEditor>
  <mx:Component>
    <mx:ComboBox
      dropdownWidth="40"
      dataProvider="{WATIcons.customIcons}"
      change="{finishEdit(event)}"
      >
      <mx:Script>
        <![CDATA[
          import mx.events.ListEvent;
          private function finishEdit(e:ListEvent):void
          {
            GridUser(data).customIcon = selectedItem.icon;
            var k:KeyboardEvent = new KeyboardEvent(KeyboardEvent.KEY_DOWN,
true, false, 0, Keyboard.ESCAPE);
            dispatchEvent(k);
          }
        ]]>
      </mx:Script>
    </mx:ComboBox>
  </mx:Component>
</mx:itemEditor>

I tried fiddling with things like sending ITEM_EDIT_END messages and such
but didn't really have any luck.  This works, but I wonder if it's really
the best way to go about it.


PS: The ComboBox is functional, but not very visually appealing.  What I'd
really like to do would be to have a spiffy TileList that drops down and has
several icons across and some down, etc.  But I haven't written that code
yet.  If someone already knows of a pre-written itemEditor for such of
thing, feel free to point the way.

-- 
Jason

Reply via email to