8 Replies Latest reply on Jan 22, 2010 2:01 PM by wrkoch

    Custom Combo Box Issue

    wrkoch Level 1
      Recently I created a custom ComboBox which fixes the arrowWidthButton bug and adds some features.  Because the ComboBox class has private functions that I couldn't override,  I was forced to copy the code into my own class,copy into an assets folder enough stuff to make the includes work, and modify it (code attached).  No problems except.....
      I had named my custom class ComboBox simply because I copied the code directly from the sdk.  Yesterday I decided it might be a better idea to name it something different to distinguish it from the one in the sdk.  I went into my class and renamed it to ComboBoxSuper.
      Now it doesn't work some of the time.  If I use ComboBoxSuper as an mxml tag, it fails silently.  If I create one in AS and then addChild it to a container, it works fine.
      I don't get it.  Can anyone explain this behavior?
        • 1. Re: Custom Combo Box Issue
          archemedia Level 4

          There are two classes involved here: ComboBox and ComboBoxSuper.


          1. check the namespace prefix for all your implementations in mxml of both classes

          2. check the package names and class contructor names in both classes.


          Hope this helps



          • 2. Re: Custom Combo Box Issue
            wrkoch Level 1

            All the namespace prefixes and package class names seem to be fine.  I even added a manifest.xml to my library project.  Still no joy.


            The ComboBox and ComboBoxSuper are both in the same library project -- they are being referenced the same way.  I am using the Flex 3.2 sdk

            • 3. Re: Custom Combo Box Issue
              archemedia Level 4

              Have you tried isolating the problem: create a brand new project, add your comboBox

              Super class and then add 2 simple mxml components, one for each class. Still messe

              d up?



              • 4. Re: Custom Combo Box Issue
                wrkoch Level 1

                Good thought.  I have a test application I tried it in.  Works just fine in that one.  But not in the application I'm designing.  Just what I needed -- some sort of weird interaction.

                • 5. Re: Custom Combo Box Issue
                  JeffryHouser Level 4

                  Show us the MXML code template that is creating the instance of the ComboBoxSuper

                  • 6. Re: Custom Combo Box Issue
                    wrkoch Level 1

                    OK.  I stripped out a ton of code from the main application and attached it along with the test file.  I am also attaching the myLibrary.swc that has the ComboBoxSuper code in it.  The main application doesn't work but the test one does.


                    Keep in mind both these application are located under the same project -- they use the same compiler settings, etc.


                    I also made a brand new project and it too failed.  My head is starting to hurt

                    • 7. Re: Custom Combo Box Issue
                      wrkoch Level 1

                      ok -- I found what is causing the error but not the root cause.  I found ComboBoxSuper failed to work is the arrowButtonWidth wasn't set.  in the mxml.  I never set it in my custom class.  There must be some default parameters that the mx:Combobox pulls in and that my custom version of the combobox was inheriting without me knowing about it.  ComboBoxSuper didn't inherit these values and fails silently.


                      Sigh.  I wonder what other defaults I'm missing. Now I have to figure out where the ComboBox or ComboBoxBase classes get their default values from.

                      • 8. Re: Custom Combo Box Issue
                        wrkoch Level 1

                        Well I've fought my way through the debugger and it is way beyond me.  Something is setting the default styles and parameters for a combobox but I can't figure out where it is or how to force my ComboBoxSuper to pick them up.  I hate relying on using the same class name but I don't have a choice.  I'm reluctant to create an arrowButtonStyle in the ComboBoxSuper constructor -- that may fix that problem but I don't know what other defaults I'm missing because I can't extend the ComboBox.


                        Anyone have a suggestion?