9 Replies Latest reply on Dec 21, 2010 5:16 PM by learner_doug

    flex 4 custom dropdownlist

    Zolotoj Level 3

      I have googled it for hours. Any sample?

       

      Thanks

        • 1. Re: flex 4 custom dropdownlist
          learner_doug Level 1

          Here is one that loads external swfs using an external XML file (not shown) to populate the list via httpService:

           

          <?xml version="1.0" encoding="utf-8"?>

          <s:Group

           

           

          xmlns:fx="http://ns.adobe.com/mxml/2009"

          xmlns:s="

          library://ns.adobe.com/flex/spark"

          xmlns:mx="

          library://ns.adobe.com/flex/mx" width="400" height="300" creationComplete="dropDownListXML.send()" xmlns:components="components.*">

           

           

          <fx:Declarations>

           

           

          <!-- Place non-visual elements (e.g., services, value objects) here -->

           

          <s:HTTPService id="dropDownListXML" url="xmldata/EBSnewMileStones.xml" />

           

          </fx:Declarations>

           

          <fx:Script>

          <![CDATA[

           

          import components.DropDownHeader;

           

           

          import mx.events.FlexEvent;

           

           

          import spark.events.IndexChangeEvent;

           

           

           

          protected function msDropDown_changeHandler(event:IndexChangeEvent):void

          {

           

           

           

          var dropDownSelection:int = msDropDown.selectedIndex;

           

           

          if(dropDownSelection == 0)

          {

          closeDropMovie_btn.visible =

          true;

          dropDownLoader.load(

          "lessons/EBS_new_Milestone1.swf");

          }

           

          if(dropDownSelection == 1)

          {

          closeDropMovie_btn.visible =

          true;

          dropDownLoader.load(

          "lessons/EBS_new_Milestone3.swf");

          }

           

           

          if(dropDownSelection == 2)

          {

          closeDropMovie_btn.visible =

          true;

          dropDownLoader.load(

          "lessons/EBS_new_Milestone5.swf");

          }

           

           

          if(dropDownSelection == 3)

          {

          closeDropMovie_btn.visible =

          true;

          dropDownLoader.load(

          "lessons/EBS_new_OW_MS18.swf");

          }

           

           

          if(dropDownSelection == 4)

          {

          closeDropMovie_btn.visible =

          true;

          dropDownLoader.load(

          "lessons/EBS_new_WH_MS14.swf");

          }

           

           

          if(dropDownSelection == 5)

          {

          closeDropMovie_btn.visible =

          true;

          dropDownLoader.load(

          "lessons/EBS_new_FO_MS7.swf");

          }

           

          }

           

           

          protected function closeDropMovie(event:MouseEvent):void

          {

          dropDownLoader.unloadAndStop();

          closeDropMovie_btn.visible =

          false;

          msDropDown.selectedIndex = -1;

           

           

          }

          ]]>

           

          </fx:Script>

           

          <s:ComboBox id="msDropDown"

          dataProvider="

          {dropDownListXML.lastResult.milestones.milestone}"

          x="

          10" y="10" width="240"

          chromeColor="

          #CCCCCC" color="#000000"

          labelField="

          name"

          change="msDropDown_changeHandler(event)"

          />

           

          <mx:SWFLoader id="dropDownLoader" x="-580" y="-20" depth="100" />

           

           

          <s:Button id="closeDropMovie_btn" depth="101" label="X-Close" x="354" y="-20" click="closeDropMovie(event)" visible="false"/>

          </s:Group>

          • 2. Re: flex 4 custom dropdownlist
            Zolotoj Level 3

            Not sure  I understand. Where exactly are extending DropDownList?

             

             

            Thanks

            • 3. Re: flex 4 custom dropdownlist
              learner_doug Level 1

              Sorry 'bout that.  This was as custom component dropdown.

               

              I'm sure you have already seen the follow basic DropDownList extending DropDownList, but just in case.  Good luck!

              • 4. Re: flex 4 custom dropdownlist
                saisri2k2 Level 4

                wht re we trying to customize here?

                • 5. Re: flex 4 custom dropdownlist
                  learner_doug Level 1

                  Is your question regarding the functionality of the component, or are you questioning why I considered it "custom?"

                   

                  Regarding the former:  the component "groups" the combo fox, xml, swf player and quit button together. 

                   

                  Regarding the latter:  I probably should not have called that custom.

                  • 6. Re: flex 4 custom dropdownlist
                    saisri2k2 Level 4

                    from the question(Original post) I could not figure out anything, If the requirements are given, atleast I could guide you in some direction / give the solution myself.

                    • 7. Re: flex 4 custom dropdownlist
                      learner_doug Level 1

                      Actually I am not the person asking the question.  I had provided some code to someone who wanted to see an example of a dropdown - I posted an example which I use.  I was not asking a question in this case.

                       

                      Sorry for the confusion and thanks for trying to be helpful.

                      doug

                      • 8. Re: flex 4 custom dropdownlist
                        saisri2k2 Level 4

                        yea, understood!  I was asking the person who strted the thread!

                        • 9. Re: flex 4 custom dropdownlist
                          learner_doug Level 1

                          I'll need to be more careful in the future.