Event.stopPropagation() or stopImmediatePropagation() (depending on whether
you want events on the current node to be executed before the event stops or
not:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="horizontal" xmlns:local="*">
    <mx:Script>
        <![CDATA[
            [Bindable]
            public var dp:Array = [
                {foo: "button 1"},
                {foo: "button 2"},
                {foo: "button 3"},
                {foo: "button 4"},
                {foo: "button 5"},
                {foo: "button 6"},
            ];

            private function dg_doubleClickHandler(event:Event):void
            {
                trace('dg double click');
            }
        ]]>
    </mx:Script>

    <mx:AdvancedDataGrid id="dg" doubleClickEnabled="true"
doubleClick="dg_doubleClickHandler(event)" dataProvider="{dp}">
        <mx:columns>
            <mx:AdvancedDataGridColumn dataField="foo" >
                <mx:itemRenderer>
                    <mx:Component>
                        <mx:Button doubleClickEnabled="true"
label="{listData.label}"
                            doubleClick="trace(listData.label + ' double
click'); event.stopImmediatePropagation();" />
                    </mx:Component>
                </mx:itemRenderer>
            </mx:AdvancedDataGridColumn>
        </mx:columns>
    </mx:AdvancedDataGrid>

</mx:Application>


Beau

On Tue, Sep 1, 2009 at 10:55 AM, Nick Middleweek <n...@middleweek.co.uk>wrote:

>
>
> Hello,
>
> I've got an advancedDataGrid (AvDG) and the first column has an item
> renderer which has a button on it. The button has a click handler.
>
> There is also a itemDoubleClick handler on the AvDG.
>
> Users are double-clicking the button so this is firing the click of the
> button handler but the doubleClick event is also being fired on the AvDG row
> item.
>
> I'm guessing this is related to event bubbling or capturing?
>
> I'm trying to stop the AvDG.row doubleClick event being fired if the user
> double clicks on the button.
>
> Anyone got any ideas? I've tried to put a doubleClick on the button in hope
> that it would handle it and therefore stop the row event from being fired
> but ti didn't work.
>
>
> Now I think i need to capture the doubleClick cancel event in the button
> object and prevent it from bubbling from the button to the AvDG. Where do I
> set event.cancelable = true?
>
>
> Thanks,
> Nick
>
>  
>



-- 
Beau D. Scott
Software Engineer

Reply via email to