Skip to main content
Participant
July 15, 2011
Question

Combobox for flex 4.5 mobile

  • July 15, 2011
  • 13 replies
  • 13414 views

I understand that there is no combobox control for mobile.

1. why can't i use the spark combobox? i've added it to the window and it looks ok in android.

2. how can i develope my own? are there any samples of creating a custom combobox in spark?

3. can my combobox have a look like the drop down in iphone? how can i skin it for andorid and for iphone.

a lot of questions....the lack of a combobox\dropdown is quite wierd for flex in mobile.

    This topic has been closed for replies.

    13 replies

    Participant
    September 6, 2011

    In addition to the options listed above you could consider checking out the e-skimo library that is freely available at http://e-skimo.com/ and includes a UniqueChoiceList and MulipleChoiceList that would probably suit your requirements for a combobox.

    July 19, 2011
    July 17, 2011

    The custom event

    package events
    {
        import flash.events.Event;
       
        public class ComboEvent extends Event
        {
            public static const COMBO_CLOSED:String = "combo_closed";
            public var picked:Object;
           
            public function ComboEvent(type:String, picked:Object)
            {
                super(type);
                this.picked = picked;
            }
        }
    }

    The pop up

    <?xml version="1.0" encoding="utf-8"?>
    <s:SkinnablePopUpContainer xmlns:fx="http://ns.adobe.com/mxml/2009"
                               xmlns:s="library://ns.adobe.com/flex/spark"
                               width="300" height="500"
                               creationComplete="skinnablepopupcontainer1_creationCompleteHandler(event)">
        <fx:Script>
            <![CDATA[
                import events.ComboEvent;
               
                import mx.collections.ArrayList;
                import mx.events.FlexEvent;
                import mx.managers.PopUpManager;
                import spark.events.IndexChangeEvent;
               
                [Bindable]
                public var dp:ArrayList;
               
                protected function skinnablepopupcontainer1_creationCompleteHandler(event:FlexEvent):void
                {
                    PopUpManager.centerPopUp(this);
                }
               
                protected function list_changeHandler(event:IndexChangeEvent):void
                {
                    dispatchEvent(new ComboEvent(ComboEvent.COMBO_CLOSED,list.selectedItem));
                        this.close();
                }
               
               
            ]]>
        </fx:Script>
        <fx:Declarations>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
        </fx:Declarations>
       
       
        <s:List id="list" width="100%" height="100%" dataProvider="{dp}" change="list_changeHandler(event)"/>
       
    </s:SkinnablePopUpContainer>

    The view

    <?xml version="1.0" encoding="utf-8"?>
    <s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
            xmlns:s="library://ns.adobe.com/flex/spark" title="HomeView" xmlns:components="components.*">
       
       
        <fx:Script>
            <![CDATA[
                import events.ComboEvent;
               
                import mx.collections.ArrayList;
                import mx.events.FlexEvent;
               
                protected var dp:ArrayList;
               
               
                protected function combobox1_creationCompleteHandler(event:FlexEvent):void
                {
                   
                }
               
                protected function comboInput_clickHandler(event:MouseEvent):void
                {
                    // TODO Auto-generated method stub
                    dp = new ArrayList(new Array(1,2,3,4,5));
                    comboPopUp.dp = dp;
                    comboPopUp.addEventListener(ComboEvent.COMBO_CLOSED,comboHandler);
                    comboPopUp.open(this,true);
                }
               
                protected function comboHandler(event:ComboEvent):void
                {
                    comboInput.text = event.picked.toString();
                }
               
            ]]>
        </fx:Script>
       
       
       
        <fx:Declarations>
            <components:ComboPopUp id="comboPopUp"/>
        </fx:Declarations>
       
       
        <s:TextInput id="comboInput" click="comboInput_clickHandler(event)"/>
           
       
    </s:View>

    mikmikiAuthor
    Participant
    July 17, 2011

    just trying to jump the message up. anyone with experience with it?

    July 17, 2011

    can you use a list in a popup window?

    mikmikiAuthor
    Participant
    July 17, 2011

    don't know where to start from. shoudl i extend combobox? why isn't it

    allowed in mobile? any good sample for it?