Hi everyone,

I was wondering if anyone could help me with a problem I have -- I need
to wire up an interface which calls for a ComboBox where the first item
in the dropdown is a TextInput control which remains static (ie. the
TextInput is always the first item in the list, even when the list is
scrolled).

I've tried a few methods, here's one of which I've had marginal success:

code for the "MXML Component ComboBox":

<mx:ComboBox xmlns:mx="http://www.adobe.com/2006/mxml";
creationComplete="init()">

     <mx:Script>
         <![CDATA[
             private function init():void {
                 var dropDownFactory:ClassFactory = new
ClassFactory(MyCustomList);
                 dropDownFactory.properties = { height: 100 };

                 this.dropdownFactory = dropDownFactory;
             }
         ]]>
     </mx:Script>

</mx:ComboBox>

code for the "AS3 list class for dropdown":

public class MyCustomList extends List
   {
     private var input:TextInput;

     public function MyCustomList() {
         input= new TextInput();
         // event listeners & styles here
         addChild(input);
     }

     override protected function updateDisplayList(unscaledWidth:Number,
unscaledHeight:Number):void {
       super.updateDisplayList(unscaledWidth, unscaledHeight);
       // position TextInput above the list
       input.move(0,-input.height);
     }

[/code]

My main problem here is that the dropdown opening and closing causes
issues with the text input control (because I have to move the text
input to position the entire dropdown, it looks strange):

[ combo box ]    <-- the combobox
-----------------
[ text input    ]    <-- the text input as the first item in dropdown
[ all items     ]    <-- all the items in the combo box here

I know I can mark the combobox editable, but this isn't an option for me
(its unfortunately beyond my control). The list involves custom sorting
methods and a built in search (from the text input). I was wondering if
anyone has ever come across a similar situation or experienced how I
could do this?

Any help would be greatly appreciated, thanks.


Reply via email to