2 Replies Latest reply on Aug 3, 2012 12:40 AM by jpwrunyan

    spark dropdownlist pulldown incorrectly positioned inside swfloader

    jpwrunyan Level 1

      Today I encountered this bug:




      I am loading another team's application via SWFLoader into my own application.  For various reasons, I must use the flag loadForCompatibility and set it to true.  I have noticed that ALL the spark DropDownList instances in the loaded sub-application offset their dropdowns incorrectly.  Since my application has a header, the pulldowns are offset vertically by the height of the header. MX versions of ComboBox in a test sub-application do not have this problem.


      I tried adding the line:







      to my Application's compiler options but it has no effect.


      I also noticed, when trying to write an import statement, that MarshallingSupport doesn't even exist.  I am using FlashBuilder 4.


      Is there any kind of workaround for this?  Am I doing something wrong?  Why must this be? Telling the other team to switch all their s:DropDownList to mx:ComboBox is going to be onerous to say the least.  It will also be very time consuming since the APIs are different.  I really hope there is something I can do to solve this problem.  Please tell me I am doing it wrong.


      This question is duplicated on StackOverflow


      http://stackoverflow.com/questions/11430074/spark-dropdownlist-pulldown-incorrectly-positi oned-inside-swfloader

        • 1. Re: spark dropdownlist pulldown incorrectly positioned inside swfloader



          I've encountered a similar problem when loading a Flex SWF into Flash. The Spark dropdowns were being offset in an incorrect fashion.


          I've managed to devise a solution that, while it's not perfect, is effective in my case.


          I've created a Custom DropDownListSkin and applied that as the skin when adding the dropdowns. You can find the basic code here


          http://opensource.adobe.com/svn/opensource/flex/sdk/trunk/samples/themes/zen/src/zen/skins /DropDownListSkin.mxml


          In the code you'll see a section called <s:PopUpAnchor id="popUp" etc.


          You will need to also create an as3 class that extends PopUpAnchor. Within this class you will need to override the function calculatePopUpPosition. Here's the code that I used, I hope this is of some help to you:


                    override protected function calculatePopUpPosition():Point


                                        var globalPoint:Point = this.localToGlobal(new Point(0,0));


                                        return globalPoint;



          What's happening here is that I'm getting the global position of the dropdown and applying the coordinates to the dropdown that I'm using

          • 2. Re: spark dropdownlist pulldown incorrectly positioned inside swfloader
            jpwrunyan Level 1

            Thanks for the help.  I had gotten as far as PopUpAnchor when I gave up before.

            As it turns out, the compiler setting for MarshallingSupport finally worked.  I have no idea what was wrong, but the other projects finally got so they would compile with MarshallingSupport included.  It might have been something as minor as the other teams not running "clean project".  I don't know.  It works now; I'm happy.