0
votes

FLEXible guys I have a little problem and need some suggestions from professionals in flex. I've a Spark List component in my flex mobile project and I've added a Callout component when user clicks on list item - it generates a new callout component and opens it. But in my case (I've tested it on iPad) it works when user clicks on list but it crashes when user double clicks (at list double) on list - its because of Creation and Adding event listeners to callout component etc. when user double clicks on list it tries to create a callout and at the same time close it as MOUSE_DOWN_OUTSIDE is triggered (its not a case in simulators because of better CPU performance). So how can I construct it to be error free - or any better advantage of callout to show details of list item. Here's my code:

    <fx:Script>
            <![CDATA[
                public var clInfo:Callout;

                protected function lst_tetkikler_clickHandler(event:MouseEvent):void
                {
                    if(lst_tetkikler.selectedItem != null){
                        clInfo = new Callout();
                        clInfo.width = 400;
                        clInfo.setStyle("contentBackgroundColor",0xf8eabd);

                        lbl_adet.text = lst_tetkikler.selectedItem['adet'];
                        lbl_puan.text = lst_tetkikler.selectedItem['puan'];

                        clInfo.addElement(vg_info);
                        clInfo.verticalPosition = "after";
                        clInfo.open(lst_tetkikler.dataGroup.getElementAt(lst_tetkikler.selectedIndex) as DisplayObjectContainer,true);
                        clInfo.addEventListener(FlexMouseEvent.MOUSE_DOWN_OUTSIDE, closeComponent);
                    }

                }

                protected function closeComponent(event:FlexMouseEvent):void
                {
                    if(clInfo){
                        clInfo.removeEventListener(FlexMouseEvent.MOUSE_DOWN_OUTSIDE, closeComponent);
                        clInfo.close(); 
                        clInfo = null;
                    }
                }


            ]]>
        </fx:Script>

    <s:List id="lst_tetkikler" width="100%" height="50%" 
                dataProvider="{listTetkik}" contentBackgroundAlpha="0" 
                visible="{!(listTetkik.length==0)}" 
                labelField="tetAdi" color="#314F83" 
                click="lst_tetkikler_clickHandler(event)"
                >
        </s:List>

Any suggestions?

1
Might help if you include the error you get when it "crashes". Other than that, it sounds like you can set a boolean flag on click so that your code an take no action on the second click (of a double click).Sunil D.
its not specific for double clicks.. application crashes on triple clicks also - tried this setting callout opening on double clicks as well. And also tried to define single callout in declarations and then open it each time on list item click - but no success the same story..Zaur Guliyev

1 Answers

0
votes

I've solved this adding all callout content under CalloutButton component - it seems Adobe team taken such cases into account only in callout button case - dynamically creating Callouts like the above scenario will crash.