Drag and Drop in DataGrid/Advanced DataGrid

Hi All,
Here is the scenario, assume that i have some 10 records in
DataGrid/Advanced DataGrid .I have selected 4th record and when i
try to drag the selected item to
down, i should be able to drag all the records one step down
from the selected record( from 4 th record to 10th record)
i.e, re-arranging the items
If i drag the selected item(assume that some 6th record) to
top, say to 2nd row then from the second row all the rows
has to come down.
And How do we
add the rows at middle and at the specified position?
Any help will be appricated and Thanks in Advance.

Hi All,
myself got the solution for re-arranging the datagrid items
by using the pre-defined properties of DataGrid.
I can also get the index number of Items while start dragging
but the problem is how do i get the index number where the Items
dropped.
Here is the code..............
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="horizontal">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.collections.ArrayCollection;
[Bindable]
private var datagridData:ArrayCollection = new
ArrayCollection([
{task:"testing drag and
drop",category:"Office",priority:"Medium"},
{task:"testing datagrid
DND",category:"personal",priority:"High"},
{task:"testing services for
todo",category:"office",priority:"Medium"},
{task:"meet ravi on
sunday",category:"personal",priority:"Low"},
{task:"buy a book",category:"friends",priority:"Medium"},
{task:"play cricket",category:"friends",priority:"Low"}]);
private function onDragStart():void
Alert.show("selected Indices"+dataGrid.selectedIndices);
private function onDragComplete():void
Alert.show("selected Indices"+dataGrid.selectedIndices);
]]>
</mx:Script>
<mx:DataGrid id="dataGrid" dataProvider="{datagridData}"
dragEnabled="true" dragMoveEnabled="true"
dropEnabled="true" allowDragSelection="true"
allowMultipleSelection="true" rowCount="10"
dragStart="onDragStart()"
dragComplete="onDragComplete()">
<!--dragStart="onDragStart()"-->
<mx:columns>
<mx:DataGridColumn dataField="task" headerText="Task"
width="200"/>
<mx:DataGridColumn dataField="category"
headerText="Category"/>
<mx:DataGridColumn dataField="priority"
headerText="Priority"/>
</mx:columns>
</mx:DataGrid>
</mx:Application>

Similar Messages

  • Error 1009 when dragging and dropping

    Hello All,
    I have a problem in a large application with dragging and dropping between datagrids. I created a simple example of the issue below. Basically, when I press the button I get a pop-up with 2 datagrids. When Initially try to drag an item from the source grid to the destination grid I get a serious of errors:
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    ..etc
    If I then try and drag and drop again, it works without error. Can anyone shed light on this? Code below:
    The Main App:
    <?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/halo" minWidth="1024" minHeight="768">
        <fx:Script>
            <![CDATA[
                import mx.core.FlexGlobals;
                import mx.core.IFlexDisplayObject;
                import mx.managers.PopUpManager;
                import mx.managers.DragManager;
                private var popUpManager:PopUpManager;
                private var dragManager:DragManager;
                protected function button1_clickHandler(event:MouseEvent):void
                        var largePanelWindow:IFlexDisplayObject = PopUpManager.createPopUp(FlexGlobals.topLevelApplication as DisplayObject, testDrop, true);
                        var largeSimPanelInstance:testDrop = largePanelWindow as testDrop;
                        PopUpManager.centerPopUp(largeSimPanelInstance);
            ]]>
        </fx:Script>
        <fx:Declarations>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
        </fx:Declarations>
        <s:Button x="546" y="59" label="Button" click="button1_clickHandler(event)"/>
    </s:Application>
    The Component:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
             xmlns:s="library://ns.adobe.com/flex/spark"
             xmlns:mx="library://ns.adobe.com/flex/halo" width="400" height="300" creationComplete="creationCompleteHandler()">
        <fx:Script>
            <![CDATA[
            private function creationCompleteHandler():void
                srcGrid.dataProvider = ['cat','dog','bird'];
                destGrid.dataProvider =[];
            ]]>
        </fx:Script>
        <s:Panel x="10" y="0" width="380" height="290">
            <mx:DataGrid id="srcGrid" dragEnabled="true" dragMoveEnabled="true" x="58" y="44">
                <mx:columns>
                    <mx:DataGridColumn headerText="Column 1" dataField="col1"/>
                </mx:columns>
            </mx:DataGrid>
            <mx:DataGrid id="destGrid" dragEnabled="false" dropEnabled="true" x="226" y="44">
                <mx:columns>
                    <mx:DataGridColumn headerText="Column 1" dataField="col1"/>
                </mx:columns>
            </mx:DataGrid>
        </s:Panel>
        <fx:Declarations>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
        </fx:Declarations>
    </s:Group>

    I can confirm this error. I'm using Firefox, Windows Vista, Flash Player 10, SDK build 11250. There are two error boxes that appear when you try to drag an item on the first attempt and on successive attempts (but only if you drag over the destgrid, then back to the srcgrid and then back again to the destgrid). It's gotta be a bug, here are the stack traces:
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
         at mx.controls.listClasses::ListBase/hideDropFeedback()[E:\dev\trunk\frameworks\projects\framework\src\mx\controls\listClasses\ListBase.as:8548]
         at mx.controls::DataGrid/hideDropFeedback()[E:\dev\trunk\frameworks\projects\framework\src\mx\controls\DataGrid.as:5670]
         at mx.controls.listClasses::ListBase/dragDropHandler()[E:\dev\trunk\frameworks\projects\framework\src\mx\controls\listClasses\ListBase.as:10428]
         at flash.events::EventDispatcher/dispatchEventFunction()
         at flash.events::EventDispatcher/dispatchEvent()
         at mx.core::UIComponent/dispatchEvent()[E:\dev\trunk\frameworks\projects\framework\src\mx\core\UIComponent.as:11826]
         at mx.managers.dragClasses::DragProxy/_dispatchDragEvent()[E:\dev\trunk\frameworks\projects\framework\src\mx\managers\dragClasses\DragProxy.as:355]
         at mx.managers.dragClasses::DragProxy/mouseUpHandler()[E:\dev\trunk\frameworks\projects\framework\src\mx\managers\dragClasses\DragProxy.as:580]
         at mx.managers.dragClasses::DragProxy/mouseLeaveHandler()[E:\dev\trunk\frameworks\projects\framework\src\mx\managers\dragClasses\DragProxy.as:530]
         at flash.events::EventDispatcher/dispatchEventFunction()
         at flash.events::EventDispatcher/dispatchEvent()
         at mx.managers::SystemManager/mouseLeaveHandler()[E:\dev\trunk\frameworks\projects\framework\src\mx\managers\SystemManager.as:3314]
         at flash.events::EventDispatcher/dispatchEventFunction()
         at flash.events::EventDispatcher/dispatchEvent()
         at mx.core::UIComponent/dispatchEvent()[E:\dev\trunk\frameworks\projects\framework\src\mx\core\UIComponent.as:11826]
         at mx.managers.dragClasses::DragProxy/_dispatchDragEvent()[E:\dev\trunk\frameworks\projects\framework\src\mx\managers\dragClasses\DragProxy.as:355]
         at mx.managers.dragClasses::DragProxy/dispatchDragEvent()[E:\dev\trunk\frameworks\projects\framework\src\mx\managers\dragClasses\DragProxy.as:342]
         at mx.managers.dragClasses::DragProxy/mouseMoveHandler()[E:\dev\trunk\frameworks\projects\framework\src\mx\managers\dragClasses\DragProxy.as:509]
    and
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
         at mx.core::UIComponent/drawFocus()[E:\dev\trunk\frameworks\projects\framework\src\mx\core\UIComponent.as:9008]
         at mx.controls.dataGridClasses::DataGridBase/showDropFeedback()[E:\dev\trunk\frameworks\projects\framework\src\mx\controls\dataGridClasses\DataGridBase.as:2954]
         at mx.controls::DataGrid/showDropFeedback()[E:\dev\trunk\frameworks\projects\framework\src\mx\controls\DataGrid.as:5640]
         at mx.controls.listClasses::ListBase/dragEnterHandler()[E:\dev\trunk\frameworks\projects\framework\src\mx\controls\listClasses\ListBase.as:10337]
         at flash.events::EventDispatcher/dispatchEventFunction()
         at flash.events::EventDispatcher/dispatchEvent()
         at mx.core::UIComponent/dispatchEvent()[E:\dev\trunk\frameworks\projects\framework\src\mx\core\UIComponent.as:11826]
         at mx.managers.dragClasses::DragProxy/_dispatchDragEvent()[E:\dev\trunk\frameworks\projects\framework\src\mx\managers\dragClasses\DragProxy.as:355]
         at mx.managers.dragClasses::DragProxy/dispatchDragEvent()[E:\dev\trunk\frameworks\projects\framework\src\mx\managers\dragClasses\DragProxy.as:342]
         at mx.managers.dragClasses::DragProxy/mouseMoveHandler()[E:\dev\trunk\frameworks\projects\framework\src\mx\managers\dragClasses\DragProxy.as:509]
    - e

  • Drag and drop between two Datagrid

    I have to drag and drop data between two different datagrid but in drop side i have to modify the item.
    How Can I do it?
    Thanks
    A

    Instead of using a DataGrid, you could use a Tile or TileList component.
    DataGrid does not have your desired behavior.
    You could create a custom component that uses states to display data in a DataGrid or Tile/TileList and switch states as appropriate.
    If this post answers your question or helps, please mark it as such. Thanks!
    http://www.chikaradev.com
    Adobe Flex Development and Support Services

  • Datagrid not refreshing after drag and drop

    Please help me solve this: my datagrid DOES refresh itself,
    but only after the SECOND drag and drop.
    Here's an example of my datagrid :
    1. Label a Description a
    2. Label b Description b
    3. Label c Description c
    When I drag the third row to the top of the datagrid, I want
    to see updated row numbers like this:
    1. Label c Description c
    2. Label a Description a
    3. Label b Description b
    But I see this
    3. Label c Description c
    1. Label a Description a
    2. Label b Description b
    Now let's swap rows 2 and 3; now the datagrid will correctly
    show 1. in the first row! (Of course 3. and 2 are messed up until
    the next drag and drop).
    1. Label c Description c
    2. Label b Description b
    1. Label a Description a
    As you can see, row #1 is now correctly displaying "1." This
    is happening only after the second drag and drop occurs.
    Here's my strategy:
    1. I'm using a datagrid with an ArrayCollection as the
    dataprovider.
    2. The datagrid uses the dragComplete event to call a
    function (function shown below).
    3. This function uses a loop to update the property GOALORDER
    of each row in the ArrayCollection
    4. This function also creates an object of new GOALORDER's to
    update the database (this part is working fine).
    I've noticed somewhere in the docs that, when a datagrid is
    experiencing multiple changes it turns on
    ArrayCollection.disableAutoUpdate automatically. IS THIS TRUE? This
    could explain why my datagrid does not immediately refresh.
    Is there some way to drag and drop, update the
    ArrayCollection, and refresh the datagrid- in that order?
    Thanks!
    Here's the misbehaving function!
    // re-sort the list NOTE first index=0, first goalorder=1
    private function reSort():void
    var params:Object = new Object();
    params.DBACTION = "reorder";
    var i:int;
    var g:int;
    for (i = 0; i < acGoals.length; i++)
    g=i+1;
    // replace GOALORDER in ArrayCollection
    var editRow:Object = acGoals
    editRow.GOALORDER = g;
    acGoals.setItemAt(editRow, i);
    // create multiple entries to edit database
    params["GOALID"+g]= acGoals.getItemAt(i).GOALID;
    params["GOALORDER"+g]= g;
    params["rowsToUpdate"] = g;
    //HTTPService to
    hsGoalAction.send(params);

    Fateh wrote:
    I just forgot to make the event scope of the dynamic action LIVE...and that the <tt>font</tt> element has been deprecated since 1999 and now does not exist in HTML?

  • Referencing a source datagrid from within a drag and drop handler

    My application implements a drag and drop between two datagrids.
    I would like to keep track of how many times a particular row in the source datagrid has been dragged to the target.
    The drag and drop handler should increment a DataGridColumn in the source datagrid row each time this happens.
    I can't figure out a way to refer back to the source datagrid and set a value in its dataprovider from within the drag and drop handler function.
    The source datagrid is in a module and the target datagrid in in a popup called from the module. The function below is in the popped up custom component.
    public function dragDropHandler(event:DragEvent):void
       if (event.dragSource.hasFormat("items"))
          var sComponentName:String;
          var iPos:int;
          //From which component was the drag initiated? This works sComponentName is set
          sComponentName = String(event.dragInitiator);
          //This does not work, compile error
          iPos = event.dragInitiator.selectedIndex;
             trace("Comp:MealPlanDetailCreate, function:dragDropHandler - event.dragInitiator: " + event.dragInitiator + "    parent container: " + event.dragInitiator.parent)
            trace( "    sComponentName: " + sComponentName +" name pos: " + sComponentName.indexOf("dgMP"))

    Hi ZolanSilv...,
    attached is an example of what i mean.
    Hope it helps.
    Mike
    Message Edited by MikeS81 on 08-18-2008 12:35 PM
    Attachments:
    draganddrop_image_LV85.vi ‏19 KB

  • Advanced Data Grid - Drag and Drop

    I have a drag and drop enabled Advance Datagrid that is
    populated by an arraycollection. Although it is not shown below,
    each object within the arraycollection has the attribute "GroupID"
    and based on that id is associated to a group using the
    GroupingCollection. Dragging and dropping a row from one grouping
    to the another grouping works great - i.e.if Row2 from GroupA is
    dragged and dropped into GroupB.
    The problem is that I need to update the database to reflect
    the change as well. In order to do that I have to capture the
    GroupID value that is associated with the new group - in this case
    GroupB. Unfortunately, this is where I am stumped and need some
    help. Any help would be greatly appreciated.
    GroupA (GroupID = 1)
    -- Row1
    -- Row 2
    GroupB (GroupID = 2)
    -- Row1
    private function dragHandler(e:DragEvent):void{
    var dg:AdvancedDataGrid = AdvancedDataGrid(e.currentTarget);
    //Get GroupID of new grouping
    //Call webservice and udpate database
    //Refresh datagrid

    I haven't worked with ADG and reag/drop, but with regular DG:
    var iTargetIndex:int = dg.calculateDropIndex(e);
    With the index you can find the item in the dataProvider.
    Tracy

  • Drag and drop advancing when it shouldn't - Any ideas?

    I have created a drag and drop interaction with 4 drop targets and 8 drop sources. All targets will accept all sources but only hold 2. If the drop is "correct" it will execute an advanced action which shows a tick if it is "incorrect" it will play an incorrect sound.
    This is all working fine when you drag the correct items but if you drag 5 incorrect it advances to the next slide unexpectedly. I have everything set to pause and buttons on the screen which should stop the timeline.
    Any ideas how I can stop this from auto-advancing?
    Thanks in advance!

    The reason is in the fact that you are using simple instead of standard advanced actions:
    Why choose Standard over Simple action? - Captivate blog
    I repeated that remark in: Drag&Drop tips - Captivate blog

  • Advanced Feedback with Drag and Drop Interaction

    Hello,
    I am trying to create a drag and drop interaction that will blend in a "thumbs up" or a "smiley" after each dragable has been correctly placed. The dragables in my interaction are medical terms and the drop sources are smart shape boxes. Each drop source has been assigned one correct answer, so that when the correct answer has been dragged a "success caption" appears immediately. The opposite occurs with an incorrecty dragged term. I figured, I need a "code" that
    askes each dropable if it is the last one to be answered, and when answered correctly, will show the "smiley"
    checks if all other dragables have been placed correctly
    Since I lack the basic coding knowledge, I am having a hard time trying to figure this one out. Thanks for the help, again!
    -Nik

    Hi Jay,
    Yes, could create such a scenario, but the Submit button is not used in that case, because the feedback will appear immediately when a drag object has been placed on the target. Is that OK?
    Here the work flow:
    Besides the object, create all the feedback text containers that you need, correct and incorrect and label them so that they are easily recognizable. I labeled them FB_1, FB_2... because my objects were Drop1, Drop2...
    Make those feedbacks initially invisible and group them in Gr_FB
    Create the drag&drop in the normal way with one correct link
    Select the target and in the in the D&D panel, click on the Accept button, change the settings like this
    The advanced actions are pretty simple, standard, with two statements: Hide Gr_FB and Show FB_n  (with the appropriate feedback container - you cannot use Shared actions in this dialog).
    In the D&D panel, choose Infinite for the number of attempts and uncheck the Failure caption.
    Lilybiri

  • Drag and Drop between TabNavigators

    Hi,
    I have two tabs. Each tab has an advanceddatagrid. Is it possible to drag and drop a row from the advanceddatagrid of Tab1 to the datagrid in Tab2. If so please help.
    Thanks in advance.

    Can anyone please help on this?

  • A question about drag and drop

    I have multiple images which can be dragged and dropped in a canvas. How can I get information about pictures into dataGrid, for instance the name and value (price) of an image? Currently my images are in array like this:
    private function init():void {
    currentExampleImage = imageExampleArray[imgExampleCurrentIndexNumber];
    private var imgExampleCurrentIndexNumber:Number = 0;
    private var imageExampleArray:Array =
    "assets/image1.png",
    "assets/image1.png"
    and they are run with loop like this:
    [Bindable] protected function get currentExampleImage():String {
        return _currentExampleImage;
    protected function set currentExampleImage(value:String) : void {
        _currentExampleImage = value;
    private function nextExampleImage(e:MouseEvent):void {
        if(imgExampleCurrentIndexNumber < imageExampleArray.length - 1)
        imgExampleCurrentIndexNumber++;
        currentExampleImage = imageExampleArray[imgExampleCurrentIndexNumber];
    else
        imgExampleCurrentIndexNumber = 0;
        currentExampleImage = imageExampleArray[imgExampleCurrentIndexNumber];
    So the question is that how can I set and get the name and the value of an image when it is dropped on a canvas and that information to be shown in a separate datagrid? Should I be using objects or classes? This is the drop function:
    private function doDragDrop(event:DragEvent):void
        var img:Image;
        if (event.dragInitiator.parent == whiteBoard)
            img = event.dragInitiator as Image;    
        else
            img = new Image();
            img.source = (event.dragInitiator as Image).source;
            img.addEventListener(MouseEvent.MOUSE_DOWN, doDragStart);
            whiteBoard.addChild(img);        
               img.x = event.localX - (event.dragSource.dataForFormat("localX") as Number);
               img.y = event.localY - (event.dragSource.dataForFormat("localY") as Number)
    Thanks beforehand and feel free to ask more information something is unclear.
    Message was edited by: SerpentChimera

    There's a separate empty datagrid in my application and the main intention is to make the information of each image (those dragged and dropped onto a canvas that is a designing area) being shown in the datagrid's columns Name - Quantity - Price. Those values should be obtained from each image but I'm currently unaware of the technique how the information could be added to the images.
    For instance Example1.png has a price value of 150€ and when that image is moved onto a canvas, the name and price should be shown in the datagrid and thus there should be simultaneous changes in the Quantity-column when I move the same image onto a canvas many times. Those images can also be removed from the canvas area and then the quantity should decrease. Obviously that same function should work on other images we have in a menu from where the images are dragged and then moved and dropped in the canvas. If I move Example1.png four times there should be Example1 in the name column, 4 in the quantity column and 600€ in the price column and of course all of them in the same row.
    Pay attention to the code I put into the first post. You may suggest better options how I can sort-of-import (couldn't invent better term) images to the application.
    Later there will be a row in the end of the datagrid/chart where the total price of every object that are moved on the canvas should be shown but that's another story.
    Hopefully this made some sense to the whole thing.

  • Re-create Tree control drag and drop move

    Hello,
    Ive got a tree control where dragEnabled=true and I have
    custom handlers for dragEnter, dragOver, and dragDrop so that I can
    drag/drop from datagrid's to the tree and it works fine.
    The issue is now the built in tree functionality for moving
    nodes around within the tree is gone. When I set dropEnabled=true
    it breaks the ability to drop from the datagrid to the tree.
    How can i keep the ability to move tree nodes within the tree
    and also be able to drag and drop from a datagrid onto the tree?
    Thanks for any help!

    While doing more testing I found the solution.. seriously...
    dont know how I should have known this one...
    on Tree dragOver handler:
    if( from.id == 'data_grid' ) event.preventDefault();

  • Drag and drop between two different browser

    Hi All,
    Is drag and drop in flex possible behind boundaries of
    browser context?.
    Currently i have a vdividebox which contains two datagrid
    with drag and drop functionality.
    Now I want to display this datagrid in two different browsers
    and provide the drag and drop functionality between them.
    Is their any way to achieve this?
    Thanks.

    Hey
    due to Security restrictions (Sandbox) I don't believe that
    you can Drag and Drop between two Browsers with Flex, maybe this
    can be done with AIR.
    Cheers
    Dietmar

  • Drag and drop to apply color to art.

    Hi All,
    I am designing a panel for Illustrator CS6 that displays colors in a datagrid as follows,
    [Color] [Color_Name]
    I want to be able to apply color to any art by using the drag-n-drop from the panel to the document. Is it possible that I am able to detect the art on which the color was dropped so that I can apply the color?
    Thanks!

    I came upon the NativeDragManager class of the CS Extension. We can use it to drag and drop objects from the panel to the application document. For this we use the ClipBoard and specify the format of the clipboard data. There are quite a few formats, namely, bitmap, text, url, file, etc. However, I couldn't use any of these so that I might drag a color from my panel to the document.
    Here is a code to drag and drop a text from panel to document,
    var clip:Clipboard = new Clipboard();
    clip.setData(ClipboardFormats.TEXT_FORMAT, designsDG.selectedItem.Colors);
    var allowedActions:NativeDragOptions = new NativeDragOptions();
    NativeDragManager.doDrag(designsDG.selectedItem as InteractiveObject, clip);
    Here designsDG is the datagrid containing the text.
    How can I do something similar for a color object?
    Any inputs?

  • Drag and Drop image is Duplicated

    Hi,
    In my code, I want to drag and drop an image from a list populated from a folder, and its information is populated from an xml file. Now, I can drag the image from the list and drop it in the container, However, when now, I want to drag around the dropped image, it is duplicated, an extra image is created in the canvas. So, if anyone can tell me how not to create an extra copy of the image in the new container (canvas) that it was dragged to.
    Here is the code:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"
    name="Drag and Drop Tutorial"
    creationComplete="init()"
    initialize="pictureService.send()">
    <mx:Script>
    <![CDATA[
    import mx.controls.Image;
    import mx.core.DragSource;
        import mx.core.IUIComponent;
        import mx.managers.DragManager;
        import mx.events.DragEvent;
        import mx.controls.Alert;
        import mx.rpc.events.FaultEvent;
    import mx.rpc.events.ResultEvent;
    import mx.collections.ArrayCollection;
    [Bindable] private var pictureData:ArrayCollection;
                private function resultHandler(event:ResultEvent):void{
                pictureData = event.result.data.image;
                private function faultHandler(event:FaultEvent):void{
                //code
    public function init():void
                // a mouseDown event will start the drag
          list.dataProvider = pictureData;
          //picture in the list is being dragged
           this.picture.addEventListener( MouseEvent.MOUSE_DOWN, beginDrag );
         // accepting a drag/drop operation...
           this.area.addEventListener( DragEvent.DRAG_ENTER, acceptDrop );
           // handling the drop...
          this.area.addEventListener( DragEvent.DRAG_DROP, handleDrop );
             public function beginDrag( mouseEvent:MouseEvent ):void
          // the drag initiator is the object being dragged (target of the mouse event)
           var dragInitiator:IUIComponent = mouseEvent.currentTarget as IUIComponent;
           // the drag source contains data about what's being dragged
           var dragSource:DragSource = new DragSource();
           // Add the data to the object.
                   dragSource.addData(1, 'value');
                    // Create a copy of the coin image to use as a drag proxy.
                    var dragProxy:Image = new Image();
                    dragProxy.source = mouseEvent.currentTarget.source;
                    dragProxy.setActualSize(mouseEvent.currentTarget.width,mouseEvent.currentTarget.height)
         // ask the DragManger to begin the drag
         DragManager.doDrag( dragInitiator, dragSource, mouseEvent, dragProxy ); 
    public function acceptDrop( dragEvent:DragEvent ):void
           var dropTarget:IUIComponent = dragEvent.currentTarget as IUIComponent;   
          // accept the drop
       DragManager.acceptDragDrop( dropTarget );
      // show feedback
            DragManager.showFeedback( DragManager.COPY );       
         public function handleDrop( dragEvent:DragEvent ):void
          var dragInitiator:IUIComponent = dragEvent.dragInitiator;
          var dropTarget:IUIComponent = dragEvent.currentTarget as IUIComponent;
            if(dragEvent.dragSource.hasFormat("items"))
              var items:Array = dragEvent.dragSource.dataForFormat("items") as Array;
            var img:Image = new Image();
            img.x=dragEvent.localX;
            img.y=dragEvent.localY;
            img.width = 50;
            img.height=50;
            img.source="assets/" + items[0].id + ".jpg";
            img.addEventListener(MouseEvent.MOUSE_MOVE,beginDrag);
            area.addChild(img);
       else
       dragEvent.dragInitiator.x=dragEvent.localX
       dragEvent.dragInitiator.y=dragEvent.localY
    ]]>
    </mx:Script>
       <mx:HTTPService id="pictureService"
    url="data/data.xml"
    result="resultHandler(event)"
    fault="faultHandler(event)"/>
    <mx:DataGrid id="list" width="238" height="200" y="26" x="10" labelField="src" dragEnabled="true"
    dataProvider="{pictureData}">
      <mx:columns>
      <mx:DataGridColumn dataField="id" id="code">
      </mx:DataGridColumn>
      <mx:DataGridColumn id="picture" draggable="true" >
      <mx:itemRenderer>
      <mx:Component>
      <mx:Image source="assets/{data.id}.jpg"  />  
      </mx:Component>
      </mx:itemRenderer>
      </mx:DataGridColumn>
    </mx:columns>
    </mx:DataGrid>
    <mx:Canvas id="area" x="266" y="28" width="436" height="401" backgroundColor="#c0c0c0"
    dragDrop="handleDrop(event)" >
    </mx:Canvas>
    </mx:Application>

    your handleDrop is called twice. you have assigned this eventlistener twice - one in init function and one in inline.
    remove one and it works.

  • Manually adding drag and drop

    Hi guys , obviously Im a newbie to flex...what I am doing is
    putting together a multipl file uploader so far so good but I now
    need to add drag and drop functionality and just stuck!
    1. so I am listening for drag enter and once a file or
    file(s) have been dragged over my target(datagrid) I will like to
    check the file type to ensure its of *.pdf else show and alert.
    2. I need to listen for drag drop or mouseUp and update my
    datagrid accordingly even extracting the file details from at this
    stage is baffling...pls find my code attached :(

    > Does that mean then there is some runtime introspection happening to see if the object's class is castable?
    The runtime understands what types are compatible with what other types. As a similar example that doesn't involve casting, you can assign a Button instance to a variable of type DisplayObject, but you can't assign it to a varible of type int. I believe it throws a TypeError when there is a type compatibility. But I don't think introspection is the right term for what is going on; I'd call it strict runtime type awareness.
    Gordon Smith
    Adobe Flex SDK Team

Maybe you are looking for

  • Hard disk failure and replacemen​t

    got hello, i own HP-G6-2005AX.My problem is that my hard disk is creating problem, the system does'nt boots up, when i contacted HP customer care, they told me to run hard disk dst test, the test took 3 hrs and gave result as failure. i am posting it

  • SP won't open - looking for something elses

    Try to open SP to lay some tracks against a movie I am working on. ONce it opens it is looking for a file to anther program - NI pro-53 - and will not do anything when I click to confirm finding the file. Re-instaled SP. REmoved Pro-53. Still does it

  • [svn:osmf:] 10581: Integration VAST unit tests into mediaframework unit tests

    Revision: 10581 Author:   [email protected] Date:     2009-09-24 17:09:59 -0700 (Thu, 24 Sep 2009) Log Message: Integration VAST unit tests into mediaframework unit tests Modified Paths:     osmf/trunk/framework/MediaFrameworkFlexTest/.actionScriptPr

  • Songs bought doesn't show up in Library or Purchase History

    Since I've upgraded to iOS7 and the new iTunes a couple of singles I've bought in one authorized computer doesn't show up in my other Macs (authorized with the same account) or my iPhone. When I go and search the song again in the Store it shows up a

  • ABAP Add-on bug on EhP0

    Hi all, Does anybody know if has been posted a solution for the bug in the ABAP Add-on on Ehp0? Few month ago, I posted a thread (Internal Implementation - Demo Software) and now we must to know if Nakisa or SAP have solved this issue. Thanks and bes