akamud / FlatSpark

FlatSpark is a flat skin for Flex 4 projects. It is now officially a part of Flex SDK starting from 4.14. Further development will be made in Flex official repository here: (https://github.com/apache/flex-sdk/tree/develop/frameworks/projects/flatspark)
Apache License 2.0
75 stars 35 forks source link

the DropDownListSkin has a bit bug #3

Closed justein closed 10 years ago

justein commented 10 years ago

When I use this very beautiful skinPackage,I occasionally find a bug in it. It seems like this:when choose an item from the dropdownlist ,the selected item will appear ,but when click the white arrow again to choose another item,you 'll find the items,which located before the item you first selected,will disappear.

akamud commented 10 years ago

As we discussed by email, we finally found out that the bug only happens on Flex 4.5 (or possibly lower) SDK.

We are still investigating on what might be the cause, but that should help anyone interested in this problem.

akamud commented 10 years ago

After a lot of research we found out why this only happens on Flex SDK 4.5 and lower.

First I found a similar problem reported here, which took me to a few links that solved the problem. This answer on StackOverflow shows exactly the cause of the problem.

So, as explained here (search for Scroller) and here (in the ppt file, slide #50), they changed the Scroller component for better performance. In fact, in the slides it is stated that custom Scroller skins must be changed to accommodate that optimization.

The incompatible code goes from line 93 to line 102. The Factory object is not present before Flex 4.6, so it just can't render the Scroller component.

Considering this, we must mark FlatSpark as not compatible with version 4.5 of Flex SDK, as we should support the changes made in the component after 4.6.

But there is a workaround: If you are using Flex SDK 4.5 and can upgrade to 4.6, that would instantaneously fix the problem, as that change was introduced in 4.6. But if for some reason you cannot upgrade to Flex 4.6, there is a way to get it working. You can just lose the Factory object and use the skin "the old way". In fact, I made a Gist with a FlatSpark ScrollSkin compatible with Flex 4.5. So you can fork FlatSpark (or just download the source), replace the ScrollSkin.mxml with the Gist implementation and build a .swc version that will work with Flex 4.5.

Tl;dr: The bug only happens on 4.5 and lower, and we won't change the official skin implementation in FlatSpark because that would lose the performance optimization made on Scroller by the Adobe and Apache teams, but this Gist has an alternative if you can't upgrade to Flex 4.6.

justein commented 10 years ago

Yeah,exactly!