Home Tutorial Flex Flex4 Components Drag and Drop in the same control in Flex4

 
 

Drag and Drop in the same control in Flex4
Posted on: July 12, 2010 at 12:00 AM
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

Related Tags for Drag and Drop in the same control in Flex4:


Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.