flex4 – Flex: Why does mouseOut of a DataGroup ItemRenderer cause a state change? – Education Career Blog

I’ve found a very annoying problem with the itemRenderers in a DataGroup in flex 4, when I mouseout of the itemRenderer is returns to its default state. Here’s an example:


                    <s:VerticalLayout gap="1"/>

                        <fx:Object title="One" />
                        <fx:Object title="Two" />
                        <fx:Object title="Three" />

                                <s:State name="expanded" />
                                <s:State name="collapsed" />

                                    private function expandCollapse():void
                                        currentState = (currentState == "collapsed") ? "expanded" : "collapsed";
                                <mx:Button click="expandCollapse();" label="Click me to hide the number" />
                                    <s:VGroup height="0" height.expanded="NaN">
                                            <s:Label text="{data.title}" />

When the user clicks on the button the VGroup is collapsed as expected, but then if a user moves their mouse out of the item renderer it then collapses, i.e. returns to its default state.

Is this a bug or am I missing something here?




It turns out that ItemRenderer already has some of its own states. This example works as expected if we use a DataRenderer instead of an ItemRenderer.

Leave a Comment