Hi, all.

I've got some item renderers based on CheckBox. These item renderers
apper in a List wich is a pop up. Funny thing is when i select some
check box, hide pop up, show it again and then reset that check box to
a selected = false; it looks like something between checked/unchecked.
Grayed like it's been disabled or something. It's selected property
equals false. It behaves like it's unchecked but looks very strange.

Does anyone know what is going on with all this stuff?

Here is some example for you to check:

Item renderer CheckBoxItemRenderer.as:

package src.itemRenderers {
        
        import mx.controls.CheckBox;
        
        public class CheckBoxItemRenderer extends CheckBox {
                
                public override function set data(value : Object) : void {
                        label = "select me"
                        selected = value;
                        super.data = value;
                }
                
        }
}

Pop Up based on List CheckList.mxml:

<?xml version="1.0" encoding="utf-8"?>
<mx:List xmlns:mx="http://www.adobe.com/2006/mxml";
        itemRenderer="src.itemRenderers.CheckBoxItemRenderer"
        width="100"
        height="150">
        
</mx:List>

And the application itself testing.mxml:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
        layout="absolute">

        <mx:Button id="clickMe"
                label="click me"
                horizontalCenter="0"
                verticalCenter="0"
                click="onButtonClick()" />
        
        <mx:Script>
                <![CDATA[
                        import mx.events.FlexMouseEvent;
                        import mx.collections.ArrayCollection;
                        import src.CheckList;
                        import mx.managers.PopUpManager;
                        
                        private var _popUp : CheckList;
                        
                        private function onButtonClick() : void {
                                if (_popUp == null) {
                                        _popUp = 
CheckList(PopUpManager.createPopUp(clickMe, CheckList));
                                        
_popUp.addEventListener(FlexMouseEvent.MOUSE_DOWN_OUTSIDE,
onMouseDownOutside);
                                        PopUpManager.centerPopUp(_popUp);
                                } else {
                                        PopUpManager.addPopUp(_popUp, clickMe);
                                }
                                
                                var dataProvider : ArrayCollection = new 
ArrayCollection([
                                        false, false, false, false, false, false
                                        ]);
                                
                                _popUp.dataProvider = dataProvider;
                        }
                        
                        private function onMouseDownOutside(event : 
FlexMouseEvent) : void {
                                PopUpManager.removePopUp(_popUp);
                        }
                        
                ]]>
        </mx:Script>
</mx:Application>

If anyone has some information regarding this situation please share. :)

Thanks in advance,
R.

Reply via email to