If you TAB while the mouse is down, I'm not sure what our code will do. The 
player may send focus to the browser and then you'll get a deactivate event.  
These problems are hard to debug because even going to the debugger causes a 
DEACTIVATE event.

Alex Harui
Flex SDK Developer
Adobe Systems Inc.<http://www.adobe.com/>
Blog: http://blogs.adobe.com/aharui

From: [email protected] [mailto:[email protected]] On 
Behalf Of D
Sent: Thursday, April 23, 2009 9:25 AM
To: [email protected]
Subject: Re: [flexcomponents] Why Flex's Datagrid component is listening for 
Event.DEACTIVATE event?





I hope this will give you a better picture:

Just run it:





<?xml version="1.0" encoding="utf-8"?>
            <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
            layout="vertical"
            verticalAlign="middle"
            backgroundColor="white"
            creationComplete="onCreationComplete()">
            <mx:Script>
            <![CDATA[
            import mx.controls.Alert;

            private function onCreationComplete() : void
            {
            trace("on Creation Complete");
            systemManager.addEventListener(Event.DEACTIVATE,
            onDeactivate);

            systemManager.addEventListener(Event.ACTIVATE,
            onActivate);

            }


            private function onActivate(event : Event) : void
            {
            trace("Event.ACTIVATE is CAlled now");
            }

            private function onDeactivate(event : Event) : void
            {
            trace("Event.DEACTIVE is fired for some reason");
            }
            ]]>
            </mx:Script>

            </mx:Application>




-------
Thanks & Regards,
D


On Thu, Apr 23, 2009 at 11:52 AM, Andriy Panas 
<[email protected]<mailto:[email protected]>> wrote:


Hi Alex,

I understand what is the meaning of Event.DEACTIVATE event.

What I do not understand is why Event.DEACTIVATE is dispatched by
Flash player when the following example is run.

<------------code starts--------------->

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="vertical"
verticalAlign="middle"
backgroundColor="white"
creationComplete="onCreationComplete()">
<mx:Script>
<![CDATA[
import mx.controls.Alert;

private function onCreationComplete() : void
{
systemManager.addEventListener(Event.DEACTIVATE,
onDeactivate, false, 0, true);

}

private function onDeactivate(event : Event) : void
{
trace("Event.DEACTIVE is fired for some reason")
}
]]>
</mx:Script>
<mx:ArrayCollection id="arrColl">
<mx:source>
<mx:Array>
<mx:Object label="Student A" score="10" />
<mx:Object label="Student B" score="20" />
<mx:Object label="Student C" score="30" />
<mx:Object label="Student D" score="50" />
<mx:Object label="Student A" score="10" />
<mx:Object label="Student B" score="20" />
<mx:Object label="Student C" score="30" />
<mx:Object label="Student D" score="50" />
</mx:Array>
</mx:source>
</mx:ArrayCollection>
<mx:DataGrid
editable="true"
width="100%"
height="200"
dataProvider="{arrColl}">
<mx:columns>
<mx:DataGridColumn id="column1"
dataField="label"
editorDataField="value">
<mx:itemEditor>
<mx:Component>
<mx:ComboBox>
<mx:dataProvider>
<mx:String>Student A</mx:String>
<mx:String>Student B</mx:String>
<mx:String>Student C</mx:String>
<mx:String>Student D</mx:String>
</mx:dataProvider>
</mx:ComboBox>
</mx:Component>
</mx:itemEditor>

</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>
</mx:Application>

<-------code ends------------------>

I enter the Datagrid's first row item editor (which is Combobox
with editable="false") and then hit TAB key instantly without
releasing.

By doing so I witness that "onDeactivate" event handler is fired
every time I move via keyboard tabbing to a new itemEditor.

--
Best regards,
Andriy Panas

2009/4/20 Alex Harui <[email protected]<mailto:aharui%40adobe.com>>:

>
>
> DEACTIVATE is used to detect that the browser or some other application is
> taking focus so we close any editor that may be up.


Reply via email to