2 Replies Latest reply: Feb 29, 2012 1:00 AM by nam1490 RSS

    Native event

    nam1490

      I have created AdvancedDataGrid in flex 4.5.1. under WindowedApplication.I want to handle nativeDragStart event but it gives error as--

       

      TypeError: Error #1034: Type Coercion failed: cannot convert mx.events::DragEvent@13a8b511 to mx.events.DragEvent.

                at flash.events::EventDispatcher/dispatchEventFunction()

                at flash.events::EventDispatcher/dispatchEvent()

                at mx.core::UIComponent/dispatchEvent()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\co re\UIComponent.as:13128]

                at mx.managers::NativeDragManagerImpl/_dispatchDragEvent()[C:\autobuild\galaga\frameworks\pr ojects\airframework\src\mx\managers\NativeDragManagerImpl.as:625]

                at mx.managers::NativeDragManagerImpl/nativeDragEventHandler()[C:\autobuild\galaga\framework s\projects\airframework\src\mx\managers\NativeDragManagerImpl.as:598]

       

      I have used following code--

       

      <?xml version="1.0" encoding="utf-8"?>

      <!-- http://blog.flexexamples.com/2007/09/19/dragging-rows-between-two-different-flex-datagrid- controls/ -->

      <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml"

                                              layout="horizontal"

                                              verticalAlign="middle"

                                              backgroundColor="white">

                <mx:Script>

       

                          <![CDATA[

                                         import mx.controls.Alert;

                               protected function adg1_nativeDragStartHandler(event:NativeDragEvent):void

                                         {

                                                            // TODO Auto-generated method stub

                                                             Alert.show("Native Event Handler");

                                         }

                          ]]>

       

                </mx:Script>

                     <mx:ArrayCollection id="arr">

                               <mx:Object colA="Item A.0" colB="Item B.0" colC="Item C.0" />

                               <mx:Object colA="Item A.1" colB="Item B.1" colC="Item C.1" />

                               <mx:Object colA="Item A.2" colB="Item B.2" colC="Item C.2" />

                               <mx:Object colA="Item A.3" colB="Item B.3" colC="Item C.3" />

                               <mx:Object colA="Item A.4" colB="Item B.4" colC="Item C.4" />

                               <mx:Object colA="Item A.5" colB="Item B.5" colC="Item C.5" />

                               <mx:Object colA="Item A.6" colB="Item B.6" colC="Item C.6" />

                               <mx:Object colA="Item A.7" colB="Item B.7" colC="Item C.7" />

                               <mx:Object colA="Item A.8" colB="Item B.8" colC="Item C.8" />

                               <mx:Object colA="Item A.9" colB="Item B.9" colC="Item C.9" />

                     </mx:ArrayCollection>

                <mx:AdvancedDataGrid id="adg1" designViewDataType="tree" dataProvider="{arr}" dragEnabled="true" dropEnabled="true" nativeDragStart="adg1_nativeDragStartHandler(event)">

                               <mx:columns>

                                              <mx:AdvancedDataGridColumn dataField="colA" headerText="Column 1"/>

                                              <mx:AdvancedDataGridColumn dataField="colA" headerText="Column 2"/>

                                             <mx:AdvancedDataGridColumn dataField="colA" headerText="Column 3"/>

                               </mx:columns>

                </mx:AdvancedDataGrid>

       

      </mx:WindowedApplication>

       

      someone please help me.

        • 1. Re: Native event
          nam1490 Community Member

          I am also facing same problem while using flex 3.4. Actually we have shifted to flex 3.4 from 4.5.1 and to support AdvancedDataGrid we added datavisulation library to it.

          here nativeDragDrop event is not handled.please ,can any one suggest the way?

          • 2. Re: Native event
            nam1490 Community Member

            I want drag drop functionality itself in air application and also i want dragdrop between cs host and air application.So any one suggest which event i have to use?

            does nativeEvent support for that?