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]>:
>
>
> DEACTIVATE is used to detect that the browser or some other application is
> taking focus so we close any editor that may be up.