Archive

Posts Tagged ‘ItemRenderer’

<s:ItemRenderer/> currentState == null

October 1, 2009 1 comment

I received an Item renderer from my designer with a few states that were to be driven by some data. We are using an advanced data grid and one of the columns is rendered by this component.

We noticed that the state wasn’t reflected by the data despite the correct state being set. As it turns out, the ItemRenderer class has a getCurrentRendererState() method that can potentially return null – Specifically when there is no interaction (hovered, selected, etc…) and there is no “normal” state on your renderer.

So despite my setting the correct state, this base method was hijacking me and setting the state to null. You can fix this problem by overriding the method, or by overriding “setCurrentState” and not calling super.setCurrentState if the stateName is null.

Advertisements

Flex 4 Text Performance Issues

September 24, 2009 Leave a comment

We have been running into performance issues with a new MMSP level application where we render anywhere from 1 to thousands of items. We narrowed it down to the List, DataGroup, ItemRenderer, and related items and decided to run some tests to see what about them was taking so long.

We created an app that creates 5 lists, each with their own data group and item renderer files. We created one with vectors/gradients only (NoLabelNoBind), vectors/gradients with labels and no binding, vectors/gradients with labels and binding, and then two more with richtext in stead of labels.

We rendered 100, 200, 300, 400, and then 500 items, all of which finished except the 500 item test, where it got a 15 second script timeout exception thrown. Maybe our tests are bogus and we are doing something wrong, but we are ignorant of those techniques if that is the case. The bottom line from this test app is to use labels where RichText isn’t needed and don’t use binding but in stead set the properties of the labels from the Dto/Vo objects as the renderer receives the new item.

Per the adobe help docs, we tried adding the “useVirtualLayout” property to the layout property on the datagroup and list with the same results.

Speed Test

Speed Test

The associated source can be found here.