flex-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From modjkl...@comcast.net
Subject how to force redraw of first button custom skin in spark button bar?
Date Sat, 04 Jan 2014 16:11:25 GMT
Hi, My app uses spark ButtonBar with a custom skin (for first, middle, and last buttons), and
I change the contents of the button bar a lot depending on various user selections. The icon
in the button bar updates when the dataProvider changes, relying on a doPhasedInstantiationCallback()
trigger to call measure() function in the first button's custom skin:

    override protected function measure():void {
        setButtonImage(); // set icon for button here
        super.measure();
    }

Certain combinations of changing the dataProvider for the ButtonBar result in the ButtonBar's
first button icon not refreshing. The myButtonBar.dataProvider contents are always correct,
but the measure() and validateDisplayList() are not called in the first button's custom skin
when the dataProvider changes. 

This only effects the first button in the button bar, the other buttons update fine. It could
be coincidence, but when the first button is selected in the button bar before the dataProvider
update, and the first button (by default) is selected in new button bar after the dataProvider
changes, there is no doPhasedInstantiationCallback() for the first button (although there
are for the other buttons). When I click on a button other than the first button in the button
bar, the first button's icon is refreshed.

Any idea how to force a doPhasedInstantiationCallback() for the first button? 

I tried myButtonBar.invalidateDisplayList() but this didn't result in calling the first button
skin's validateDisplayList() function or trigger doPhasedInstantiationCallback() from what
I can see.

I also tried to force a redraw using techniques like

    ArrayCollection(myButtonBar.dataProvider).refresh();

even using a CallLater(), but still no luck. The first button's skin functions are not invoked.

I've run out of ideas how to tackle this problem. Thanks in advance for any advice.

Mime
View raw message