Skip navigation
Currently Being Moderated

spark dropdownlist pulldown incorrectly positioned inside swfloader

Jul 11, 2012 3:04 AM

Tags: #dropdownlist #spark #flex4 #swfloader #offset

Today I encountered this bug:

 

http://bugs.adobe.com/jira/browse/SDK-26147

 

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:

 

-includes=mx.managers.systemClasses.MarshallingSupport

and

 

-includes+=mx.managers.systemClasses.MarshallingSupport

 

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-pulldow n-incorrectly-positioned-inside-swfloader

 
Replies
  • Currently Being Moderated
    Jul 13, 2012 8:29 AM   in reply to jpwrunyan

    Hey,

     

    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/them es/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

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points