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.

Similar Messages

  • About Drag and drop issue

    As title, i am a newbie to flash using ActionScript 2.0 , and currently i enounter the problem with drag and drop coding. Below is my code:
    function dragSetup(clip, targ, position) {
    clip.onPress = function() {
    startDrag(this);
    clip.x +=2;
    clip.swapDepths(clip.x);
    clip.onRelease = clip.onReleaseOutside=function () {
    stopDrag();
    if (eval(this._droptarget) == targ) {
    this.onTarget=true;
    gotoAndStop(position);
    } else {
    this.onTarget=false;
    gotoAndStop(position);
    clip.myHomeX=clip._x;
    clip.myHomeY=clip._y;
    clip.onEnterFrame = function() {
    if(this.onTarget)
              this._x-=(this._x-this.myHomeX)/5;
              this._y-=(this._y-this.myHomeY)/5;
    function dragSetup2(clip, targ, correct) {
    clip.onPress = function() {
    startDrag(this);
    clip.x +=2;
    clip.swapDepths(clip.x);
    clip.onRelease = clip.onReleaseOutside=function () {
    stopDrag();
    if (eval(this._droptarget) == targ) {
    clip._visible = false;
    this.onTarget=false;
    gotoAndStop(correct+1);
    } else {
    this.onTarget=false;
    gotoAndStop(correct);
    var frame:Number = 1;
    dragSetup2(flexibleTxt, questionBox, frame);
    dragSetup(transparentTxt, questionBox, frame);
    dragSetup(blueTxt, questionBox, frame);
    dragSetup(TIRTxt, questionBox, frame);
    dragSetup(TRTxt, questionBox, frame);
    dragSetup(ssmTxt, questionBox, frame);
    dragSetup(siliconTxt, questionBox, frame);
    dragSetup(silicaTxt, questionBox, frame);
    dragSetup(silicateTxt, questionBox, frame);
    dragSetup(infraTxt, questionBox, frame);
    dragSetup(radioTxt, questionBox, frame);
    dragSetup(lightTxt, questionBox, frame);
    dragSetup(copperTxt, questionBox, frame);
    dragSetup(gopTxt, questionBox, frame);
    dragSetup(liquidTxt, questionBox, frame);
    The scenario is , whenever correct mc was drag and drop on the target mc , it move to the next frame with new target mc(new question) , for example "questionBox2".
    By applying the code above, everything work fine but i would like that whenever i "throw" the answer mc (flexibleTxt, blueTxt etc) , i want it to slide or glide for little more distance, jz like how u throw a card in real life on a smooth surface.
    I also prefer that when draging it's "angle?" change according to the direction of draging. For example if u point ur finger on north side of a card and drag to the east, it's "angle?" will change according to the direction u drag, in this case, means east.
    I know my description seem abit complicated but i really someone can undestand and help me solve this issue.
    This is the link i reference to for the code above,but i modify it to my own preference :http://www.swinburne.edu.au/design/tutorials/P-flash/T-How-to-drag-and-drop-in-Flash/ID-37 /
    PS : can i attach my fla file in this forum? if can, why i cant found any attach button?

    I am having a similar but reverse problem: Under 10.5.2, when trying to push or pull files from my wireless MacBook Pro via my Airport Extreme base station to or from my wired G5 Power PC, files hang in mid copy then stall.
    The other way around -- working from the G5 -- I have no problem at all.
    This started with 10.5, but I'm not sure if it was .1 or .2 because I upgraded from 10.4 just recently and did the combined 10.5 updates all at once on both machines.
    Thanks

  • About Dragging  and Dropping

    1-> I need to drag and drop a whole row or column within a same table.
    how would i accomplish this in an applet.
    2-> And also how can i store users personal table setting, so that next time when user logs in he can have the same view of the table.
    Please help !
    Thanks

    i solved the problem my self. not very solid solution but it works fine.
    t.addMouseListener( new MouseListener() {
              public void mouseClicked(MouseEvent e) {
              public void mousePressed(MouseEvent e) {
                   Point p = e.getPoint();
                   copyIndex = t.rowAtPoint(p);
                   System.out.println("row from : "+copyIndex);
                   stopThread();
              public void mouseReleased(MouseEvent e) {
                   Point p = e.getPoint();
                   pasteIndex = t.rowAtPoint(p);
                   System.out.println("row to : "+pasteIndex);
         //Swapping rows value manually
                   String temp[]=new String[colSize+1];
                   for(int i=0;i<temp.length;i++)     
                   {temp[i]=(String)t.getValueAt(pasteIndex,i);}
                   for(int i=0;i<temp.length;i++)     
              { t.setValueAt(t.getValueAt(copyIndex,i),pasteIndex,i); }
              for(int i=0;i<temp.length;i++)     
                   { t.setValueAt(temp[i],copyIndex,i); }
         //sending temporary row arrangement to servlet to get it permanent
                   String rowArrangement="";
                   for(int i=0;i<recSize;i++)
                        {  rowArrangement=rowArrangement+(String)t.getValueAt(i,0)+"*"; }
                   try{     
                        wheretogo=1;
                   AppletContext ac=getAppletContext();
                        URL url=getCodeBase();
                        ac.showDocument(new URL(url+"SaveRowArrangementServlet?Arrange="+rowArrangement));
                        }catch(Exception ex) {System.out.println(ex);}
              public void mouseEntered(MouseEvent e) {}
              public void mouseExited(MouseEvent e) {}
              );

  • A simple question about Drag and Relate navigation

    Dear experts
    I have found SAP help or related manuals only good at talking difficult things such as how to customise the drag and relate targets, etc.  However, after I followed exactly and then how to test.
    Then I just see pieces of information, very unstructured.  Spending me a whole day, even I can't get a good simple example on how to really perform a drag and relate at least for the proof of concept at EP 6.0.   It spent a lot of time in describing what the navgiation panels about, what drag and relate targets.  Then how to do it in once transversal.  That is, with all customisation, how to drag and relate an object.
    My step is with iview A, shows a purchase order details showing a drag and relate enabled object like vendor no.
    Then I try to drag this vendor no. to a display vendor iview, iview B.
    I have known I have to put iview A and iview B to a Drag-and-relate targets.  I am sure I have done this.  Does it mean opening the portal, I will see both iview A and iview B appearing at the same time in the drag-and-relate target area?  However, in my case, it is not, iview A only appears in that area when I load it once, same to view B.  When I load iview B, iview A links from D&R target will be wiped off.  Then how I can drag an item from iview A to B while each one of them can only appear at any time.
    Can anyone give me a simple guide (don't give me an internet link from help.com) I have been tired of this.
    First, I would to make sure if my so called self-learnt drag-and-relate simple action is correct in the steps or really I have made something wrong in the customisation or even a bug there.
    Can anyone on the planet have this experience, pls. act as my teacher in this area?
    Rgds
    Stephen

    Thanks
    I have tried the 1st way already.  But I can see both iviews existing in the D & R targets.  Now I try to drag an item with business object BUS2002 from iview A to relate to LFA1 of iview B of the same back end system.
    But iview B shown up with that data of LFA1 shown up (in my case the vendor no.)
    I have used autocomplete relationship and I have checked it has been well-defined already.  Also check from metadata at backend they are both active.
    Do you have any clues to the pitfall in my case?
    Rgds

  • Drag and drop ????

    hi all.
    i have a quick question about drag and drop.
    is it possible to drag a text file on the windows desktop into a jtextarea of an application, and display the file.??
    thanks for your time.
    Paul

    Yes, I would say it is. You need to add the correct listeners to the Panel that contains the text area, and when the right sort of file comes in, you open it, put the data into a StringBuffer and add that to the text pane. Here's a code snippet:
    import java.awt.dnd.*;
    import java.awt.datatransfer.*;
    public class MyPanel extends JPanel implements DropTargetListener
      /** drop action has been changed by drop target */
        public void dropActionChanged(DropTargetDragEvent dtde)
            // must implement
        /** dragdrop entered this panel */
        public void dragEnter(DropTargetDragEvent dtde)
            // must implement
        /** dragdrop exited this panel */
        public void dragExit(DropTargetEvent dte)
            // must implement
        /** dragdrop dragging over this panel */
        public void dragOver(DropTargetDragEvent dtde)
            // must implement
        /** dragdrop dropped on this panel */
        public void drop(DropTargetDropEvent dtde)
            Transferable t=dtde.getTransferable();
            try
                DataFlavor[] dataFlavors=t.getTransferDataFlavors();
                dtde.acceptDrop(DnDConstants.ACTION_COPY);
                System.out.println(dataFlavors.length);
                for(int i=0;i<dataFlavors.length;i++)
                    System.out.println(dataFlavors.getRepresentationClass().toString());
    if(dataFlavors[i].getRepresentationClass().equals(Class.forName("java.util.List")))
    java.util.List list=(java.util.List)t.getTransferData(dataFlavors[i]);
    for(int j=0;j<list.size();j++)
    if(m_frame.doLoad(list.get(i).toString()))
    dtde.dropComplete(true);
    return;
    break;
    dtde.dropComplete(true);
    catch(Exception e)
    Messages.javaException(e);
    The line with 'm_frame.doLoad()' is where I've detected a suitable, file, and go off to open it

  • Drag and drop in tree and grid

    Hi all, I have one question on dragging and dropping from grid to/from tree.
    In a screen I have one tree and one grid. The following operations need to be performed on this screen.
    1. Drag from grid and drop in tree.
    2. Drag from tree and drop in grid.
    3. Drag from tree and drop in tree itself.
    Actually we will add the flavors for every action. Here I am confused in how many flavors I need to take.
    What I am taking right now are:
    For tree: 3 seperate flavors.
    For Grid: 2 seperate flavors.
    Can you please advise me on this.
    Thanks and Regards,
    Balakrishna.N

    Hello,
    Try with this programs
    BCALV_TEST_GRID_DRAG_DROP
    BCALV_TEST_DRAG_DROP_02

  • Drag and drop in iTunes

    Drag and drop is seriously broken in iTunes an has made managing songs an exercise in futility.

    The problem occurs intermittently now that I think about it when I try to rearrange the order of songs that are already on the shuffle. I will highlight an album using the shift key and holding down the left click (The Mouse, MacMice). After a second if it works all songs can be dragged to wherever I want. But the problem is while still keeping the left click of the mouse held down, only one song will be dragged, thus getting the songs out of intended order. Then after using get info to find proper album order, drag and drop messes up again and again so you have a confounded mess. Anyway I didn't want to get into specifics here because I feel that flaming is just around the corner. I just wanted to voice my displeasure about drag and drop not working properly. Thanks, mp

  • Drag and Drop Listbox - Help

    Hello! I am back to doing some LabVIEW programming and ran into a problem that I cannot seem to solve.
    I am trying to use dag and drop on a listbox. I have it set to move only and it works fine. The problem is that if I have a drop event the item moved just goes away. I could not find any examples or answers in the forums.
    Anyone care to teach me about drag and drop?
    Thanks
    =====================
    LabVIEW 2012
    Solved!
    Go to Solution.
    Attachments:
    Drag Drop Listbox.vi ‏8 KB

    Hey rossu,
    I believe that I have found something that may help.  The link below explains how to select multiple items at once.
    http://zone.ni.com/reference/en-XX/help/371361J-01​/lvhowto/setting_the_number_of_sele/
    Also, it may help to repost this issue in a new forum since this one has been inactive for a while.  
    Hope this helped.
    Taylor

  • Drag and drop items still in 1z0-869 ?

    Hello, I wanna ask about drag and drop items still in 1z0-869 Exam
    " Mobile Application Developer" OR not

    Go right ahead!

  • Drag and Drop between Web Dynpro Tables on Cell Basis

    Hi Experts,
    I need to develop a Drag and Drop Functionality as follows:
    I have two tables. I want to drag a row of the first table and drop it in a particular cell of the second table.
    Is it possible to implement this using the Web Dynpro Drap and Drop Functionality?
    If not, does anybody have an idea of how to implement this using other concepts (Flash Integration, Building up a Grid of Images and defining those as drop tragets, etc..)??
    Valuable Advice is highly appreciated!
    THANKS, Johannes

    Thanks for the Video.. It gives some information about Drag and Drop, but still, it does not say what I need to know.
    Again:
    I need to know if there is a way to drag particular cells in a Web Dynpro Table to other locations in that same table. Plus: I need to know if there is a way to drag and drop rows of one table into particular cell of another table.
    Similar to what we do in our Outlook Calendars: We have a week in view and we see our appointments as blocks within that week view. Now, we can drag and drop these blocks to other locations. That is what I need to implement!
    Does anybody have an idea?
    THANKS, Johannes

  • Drag and drop components

    hi folks,
    am using jdev 11.1.1.5.0 - adfbc.
    when am i wondering about drag and drop components in ADF 11g.
    i get some of the example.
    http://www.oracle.com/technetwork/developer-tools/adf/learnmore/60-table-drag-n-drop-sample-176981.pdf
    http://www.baigzeeshan.com/2011/01/drag-and-drop-collection-in-oracle-adf.html
    http://www.baigzeeshan.com/2010/07/implementing-drag-and-drop-functionaly.html
    http://www.gebs.ro/blog/oracle/adf-drag-and-drop-hints/
    http://www.gebs.ro/blog/oracle/oracle-adf-overcome-adf-restrictions-on-copying-components-with-drag-n-drop/
    ok fine. is there any other links. make more interactive in UI
    need is :
    make my user to feel free use my application.

    What about the product documentation ?
    http://docs.oracle.com/cd/E23943_01/web.1111/b31973/af_dnd.htm#CIHCHGIF
    Also, the following book:
    has a chapter (chapter 14) on drag and drop
    http://www.amazon.com/Oracle-Fusion-Developer-Guide-Applications/dp/0071622543/ref=sr_1_cc_1?s=aps&ie=UTF8&qid=1343975521&sr=1-1-catcorr&keywords=Oracle+Fusion+Developer+Guide
    Frank

  • Drag and drop data from Numeric Control or Numeric Array to excel file

    I have two inquirries about drag and drop:
    1. How to drag and drop data from a Numeric Array or Numeric control to excel file
    2. How to drag and drop data from a Numeric Array or Numeric control to an Numeric array Indicator?
    The item 2, I tried it with the event structure, but it didnt work.
    Please do reply.
    mytestautomation.com
    ...unleashed the power, explore and share ideas on power supply testing
    nissanskyline.org
    ...your alternative nissan skyline information site

    There are very good drag and drop examples that ship with LabVIEW.  Have you looked these over to see if they can be modified for your needs?
    Matthew Fitzsimons
    Certified LabVIEW Architect
    LabVIEW 6.1 ... 2013, LVOOP, GOOP, TestStand, DAQ, and Vison

  • Drag-and-drop tree list from files/folder

    Hello all. I'm new to Flex and I'm looking for some help or
    for someone to point me in the right direction. I want to write a
    simple AIR application to accept a multiple text files (or a folder
    full of text files) when the files/folder is dragged into a tree
    list. The file/folder name will be the node name. When selected,
    the contents of the file will be displayed in a text area. The text
    file will contain a 4 x 4 number matrix with each column separated
    by a tab and each row separated by a return. (I plan on plotting
    the numbers in the matrix in the future).
    What I'm most confused about is how to go about
    dragging-and-dropping files into a tree list and creating item
    names based on the file/folder name? And does the file content need
    to go into an array collection?
    Maybe I'm going about this in a difficult way. If there is an
    easier way, I'd appreciate it if someone could share. Thank you
    all.

    I have the same problema and I´m not able to find the reason.
    The solution to get the event raised has been to copy configurations from wd standard appl FPM_TEST_DND_FORM and use my own Z feeder class : all  seems to work perfectly , but , if I try to do it from scratch the event  FPM_DROP_COMPLETED it´s not raised .
    I´ve compared both configurations/class ( the one that I´ve done from scratch  that it doesn´t raise the event and the one that I´ve adapted copying from standard that it raises perfectly  the event) and I haven´t  seen any difference (maybe I haven´t found) .

  • Drag and drop parts of an image

    Is there a way to display an image (such as a scanned page) and then have areas that can be dragged and dropped? For instance, suppose the scanned page has some text fields. I would like some of text fields in the scanned form to have boxes around them (perhaps a different color, perhaps marching ants) to indicate that they are fields of interest. I would like to be able to drag and drop one of those text fields onto another text field (probably on the right side of a split pane - this right panel is not a scanned image but a panel with real fields). I've seen information about dragging and dropping fields and images but not precisely this problem. Thanks for any help. I'm new to Swing and so am out of my league.

    You want the user to select the area? Sure that can be done fairly simply. You want the app to automatically figure out what parts of an image are what? That's not simple at all.
    Either way, it's not so much about swing as custom painting. Try checking this out:
    http://www.jhotdraw.org/

  • Why can't I drag and drop songs within my playlist?

    Why can't I drag and drop songs within my playlist?

    Are you automatically updating your iPod?
    Are you talking about dragging and dropping in iTunes?
    ~iBook G4 1.07GHz (Kaiya), with extra 256MB RAM (Mac OS X 10.3.9)~ LaCie 160GB external hard drive~ ~3G 15GB iPod (Nakai)~ ~GiveStarsto users who earn them.~

Maybe you are looking for