Share on Google+Share on Google+

Drag and Drop in the same control in Flex4

Advertisement
We use the three property dragEnabled, dropEnabled and dragMoveEnabled for performing drag and drop operation.

Drag and Drop in the same control in Flex4:

We use the three property dragEnabled, dropEnabled and dragMoveEnabled for performing drag and drop operation. In this example you can see how we can drag and drop the item in the same component.

Example:

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

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

xmlns:s="library://ns.adobe.com/flex/spark"

xmlns:mx="library://ns.adobe.com/flex/mx"

minWidth="955" minHeight="600">

<fx:Script>

<![CDATA[

import mx.collections.ArrayCollection;

private function gridinitialize():void {

studentData.dataProvider =new ArrayCollection([

{aName:'Bikrant', DOB:'01/01/1986',

City:'Delhi', State:'NewDelhi'},

{aName:'Brijesh', DOB:'15/07/1984',

City:'Noida', State:'Uttar Pradesh'},

{aName:'Gaurav', DOB:'27/06/1989',

City:'Mumbai', State:'Maharashtra'}

]);

}

]]>

</fx:Script>

<s:Panel title="Drag and Drop in the same control"

chromeColor="#555555"

color="#CCCCCC" width="425" height="254">

<mx:ApplicationControlBar width="423"

horizontalAlign="center">

<s:Label text="Student Information"

color="#000000"

fontFamily="Verdana"/>

</mx:ApplicationControlBar>

<mx:DataGrid id="studentData"

allowMultipleSelection="true"

dragEnabled="true"

dropEnabled="true"

dragMoveEnabled="true"

color="#000000"

x="10" y="33"

creationComplete="gridinitialize()">

<mx:columns>

<mx:DataGridColumn dataField="aName"/>

<mx:DataGridColumn dataField="DOB"/>

<mx:DataGridColumn dataField="City"/>

<mx:DataGridColumn dataField="State"/>

</mx:columns>

</mx:DataGrid>

</s:Panel>

&l</s:Application>

Output:

Running Application:

To view this page ensure that Adobe Flash Player version 10.0.0 or greater is installed.

Download this code

Advertisements

Advertisement

Posted on: July 12, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.