Drag/Drop rejection at dragOver event time

I need to reject certain drops based on information about the
drop target node (insertion node). I am currently doing this by
obtaining the drop index and then selecting that index to be able
to reference the selectedItem as the following code shows:
dropTarget.selectedIndex = dropIndex-1;
insertionNode = dropTarget.selectedItem as XML;
This is a bit invasive since it has altered the target. Is
there any way to obtain the insertionNode without setting the
'selectedIndex' of the target?

I manage a way to solve part of my questions.
I already have all sounds working, and the drag action working and everything's seems right. I've tryied almost 10 different codes and my searches leading to nothing about how to get a "points variable" working on and "drop target" thing, with "gotoAndStop(frame_I_want - Next Level). Right now, on this, I just have the jigsaw pieces with drag action working and a transparent square on target site. I already tryied to write some codes to make my square the "dropTarget", but or I get errors, or simply don't work.
How should I work with this question? A variable for "points" and another variable for "nextLevel" (even knowing that I'll only want to be there when the jigsaw piece is in the same position as my "square dropTarget")?
Thank you for everything anyway!
Much appreciated.

Similar Messages

  • Drag & Drop kills Tree Change event

    I have a tree that I am dragging from to a HorizontalList.
    Anyway, I have the actual drag and drop working fine. However, my
    tree has a handler for it's change event so that when the selected
    item changes, a web service lookup is initiated. After the drag and
    drop the tree appears to have a different item selected, however
    the change event does not fire. Also if I manually click on the
    same row that already appears selected, the event fires and my
    lookup is kicked off.
    It's like after the drag drop the tree's selected item
    appears selected VISUALLY but the tree does not know it is the
    selected item.
    HELP PLEASE.
    P.S. - I am using Flex 2.01 by the way.

    The trick is not to use the tree drag* properties of the
    control and instead use the DragManager to do custom drag and drop.
    This allows to listen to mouse down events and evaluate
    whether to useDragManager.doDrag() to initiate a drag.

  • Effect on Sprite breaks drag&drop mechanics

    Hello,
    I've a problem with applying effects to a number of SpriteVisualElements.
    I had set up a grid of said sprites and could drag and drop them around using the startDrag() and stopDrag() methods.
    I then decided to use effects to somehow animate these sprites when I click or drag them, and chose to play the effects in the handler of the MouseEvent.MOUSE_UP event.
    Things still work, but.... some effects break the drag&drop operation.
    The first time I drag or click the sprites everything works fine, but when I try to drag them again after the effect has been played once they won't drop. I can see the sprites move along with the mouse cursor as i drag them, but when I release the mouse button the sprites jump back to their starting position instead of dropping where I've just dragged them.
    This happens only on individual sprites once the effect has been played on them a first time. After that the effect still plays each time (meaning that the MOUSE_UP event is dispatched), but they won't drop.
    I'm also tracking the coordinates of the sprites as they are dragged, using a label I update through the MOUSE_MOVE event. The sprites' coordinates update normally the first time I drag&drop them, but then, after the effect is played for the first time, the coordinates won't update either.
    This only happens with effects that affect the sprites' appearance: s:Animate (scaleX, scaleY), s:Rotate, s:Scale.
    The only one that seems to work without causing any problem is s:Move. Don't understand why.
    Does anyone have any idea?
    Thanks a lot

    Oh, I see. Thanks.
    So... i should use the "normal" flex drag&drop.
    There is just a problem, the documentation says:
    The following Flex features are not supported in mobile applications:
    No support for drag-and-drop operations
    http://help.adobe.com/en_US/flex/mobileapps/WSf3db6597adcd110e19124fcb12ab3a1c319-8000.htm l#WSca1097f1363f276f-8bfd51512ba1a8112c-8000
    I had to work my way around this limitation one time in the past. I assumed that those lines referred to list-based controls only and I figured that maybe I could manually implement drag&drop with my custom components, which I did. It worked quite well, but unfortunately it also made the mouse cursor appear beneath my fingertip. It was very annoying and I couldn't find a way to get rid of it.
    I also thought about implementing the "flex" drag&drop using TouchEvents instead of MouseEvents (maybe that was the cause of the problem, I thought), but the DragManager.doDrag() method requires a MouseEvent as argument.... and that's when I decided to switch to the more basic .startTouchDrag() and stopTouchDrag() methods.
    Now, is there something else I could try?
    How do other people (more experienced than me) implement their drag&drop mechanics, for starters?
    Thank you :-)

  • ADG drag&drop issue

    Hey all,
    A strange problem i came across:
    I have a ADG which gets its data from an XML of 3 levels
    (<root><node><childnode/></node></root>)
    All works great but i have this strange issue:
    Once a drag&drop action is completed the first row of the
    ADG is automaticly selected.
    I tried using the dragComplete event and set the
    myADG.selectedIndex to null, or -1 but it doesnt do anything (the
    first row is still auto selected),
    I did find that if i use myADG.expandall() in the
    dragComplete event it does work, but it doesnt help me...
    So my question is: how can i make the ADG not to select any
    row after drag&drop action?
    Thanks

    onDragEnter(event) {
    if (fail) {
    event.preventDefault();
    DragManager.showFeedback(DM.NONE);
    return;
    }

  • How to drag drop a calendar item to a time in next week ?

    Hi
    creating a event through a big menu is fine ... but a very elegant and quick way is to select the cells and write the event. similarly, drag-drop a event is super easy way to re-schedule an event to another time. when i have 20-30 events to re-schedule from current to next week, drag-drop is best.
    however, i am unable to do that. when i drag drop, i cant drop it to next week (i am using weekly view to be able to select any time of destination day for drop - the bi-weekly or monthly views don't allow choice of destination time)
    this could be implemented in two ways :
    1. in current weekly view, if the drag crosses the boundary, calendar shifts to the next (or previous) week. and then i drop the event.
    2. there can be a option to see upto 2 weeks in columns just like 1 week view. i understand that the columns will be too tight but the fullscreen option makes it very usable.
    or, you can suggest your own work-around.

    instead of using target, try using currentTarget...
    event.currentTarget.startDrag();
    event.currentTarget.stopDrag();

  • Drag and drop photos into an event?

    Is it possible to drag a photo from the finder into a specific iPhoto event?
    In my head it makes sense that if you have an event open in iPhoto you should be able to drop new photos into, rather than what currently seems to happen where they are treated as a new event and a new one is created, meaning I then have to navigate to the events and drag the new onto the old to merge them.

    Is it possible to drag a photo from the finder into a specific iPhoto event?
    No
    Events are designed to be time based so adding to an event does not really fit well -- You might consider leaving them time based and doing your organization with key words and/or albums/folders
    To keep your work flow and ease the event merge procedure if in preferences you un-check "autosplit into events" under the events section you can build a set of folders on the desktop like "new import - event A", "new import event B" etc and drag them to iPhoto - new events will be created with the folder names and you can then easily drag the imported folders onto the target folders to merge them
    Good Luck
    LN

  • How to drag and drop a picture at run time in a window displaying pictures?

    How to drag and drop a picture at run time in a window displaying pictures on the front panel. The main thing is that the window is displaying frames continuously?

    vivman,
    So from your description you have a picture control where you've already created an image and you'd like to drag an image around inside of the picture control. This can be done although it is going to take a significant amount of research and programming on your behalf. You can use the drag event in the event handler to find out when the drag occurs and where the cursor is. Then edit the picture as you move your mouse so that when you drop the picture gets updated.
    The even structure is a somewhat advanced topic and the drag and drop feature is one of the more advanced uses of this structure. I would search the example finder (help>>find examples) for "event" and "drag" to see how to use these events. Also you'll want to look at the examples for the picture control.
    Sounds like a cool project! Check out Darren's Weekly Nugget 10/30/2006 this topic (http://forums.ni.com/ni/board/message?board.id=170&message.id=212920). It might prove useful.
    Good luck!
    Chris C
    Chris Cilino
    National Instruments
    LabVIEW Product Marketing Manager
    Certified LabVIEW Architect

  • Triggering pop-up event through drag & drop?

    Hi everyone, I'm a newly registered member of this forum.
    I've roughly browsed though this forum to seek a solution for my problem, but I can't seem to find a suitable solution (perhaps i should continue looking).
    Scenario:
    Anyway, I'm facing some technical challenges in flex as I'm relatively new to it.
    I'm trying to create a web application, where users use drag & drop to input information.
    I visualize this process:
    User selects icon from a list
    User drags the icon onto target area
    User releases icon over target area
    Pop-up appears with a form for users to input information.
    Users input information and submits
    Information is stored in the database.
    Present knowledge:
    Because I'm new to Flex, I tried to break this down and learn by components:
    I'm able to:
    Create a drag & drop effect
    Create connection to database using HttpService
    Main Problem:
    I'm able to use the drag and drop functionality but I cannot trigger a pop-up event when the icon is dropped onto the target area.
    Sorry if the problem seems a little insignificant due to my lack in knowledge.
    I'm just a student trying to learn. Hope that someone can help me out here, or provide me with relevant links to learning resources.
    Thanks in advance,
    Jord

    Hi,
    thanks so much for replying, but I would really appreciate a little bit more help.
    I vaguely understand the concepts of DragEvent.DRAG_DROP, but I'm not really familiar with the syntax of how to cause allow a pop-up to appear.
    This is how my script look like:
    <mx:Script>
            <![CDATA[
                import mx.events.DragEvent;
                import mx.containers.Box;
                import mx.managers.DragManager;
                import mx.core.DragSource;
                import mx.collections.ArrayCollection;
                import mx.rpc.events.ResultEvent;
                [Embed("IconAssets/1.gif")]
                [Bindable]
                public var personalAsset:Class;
                [Embed("IconAssets/2.gif")]
                [Bindable]
                public var investment:Class;
                [Bindable]
                private var iconValue:uint;          
                private function iconDrag (event:MouseEvent, value:uint):void
                        var dragInitiator:Image = event.currentTarget as Image;
                        var dragSource:DragSource = new DragSource();
                        dragSource.addData(value, 'value');
                        var dragProxy:Image = new Image();
                        dragProxy.source = event.currentTarget.source;
                        DragManager.doDrag(dragInitiator, dragSource, event, dragProxy);
                private function dragOver(event:DragEvent):void
                        var dropTarget:Box=event.currentTarget as Box;
                        if (event.dragSource.hasFormat('value'))
                                dropTarget.setStyle("borderThickness", 5);
                                DragManager.acceptDragDrop(dropTarget);
                private function dragAway(event:DragEvent):void
                        var dropTarget:Box=event.currentTarget as Box;
                        revertTarget();             
                private function dragAccept(event:DragEvent):void
                        var value:uint = event.dragSource.dataForFormat('value') as uint;
                        The trigger for the Pop-up should be placed here.
                        revertTarget();
                private function revertTarget():void
                    fStatement.setStyle("borderThickness", 1);
            ]]>
        </mx:Script>
    I'm not sure whether I'm correct to state (in bold, italic, & underline) above that the event trigger for the pop-up should be within that particular function.
    The difficulty I'm facing now is that the (structure of the) popup should be written in MXML and yet I have to place them in the ActionScript.
    (I sense that I have a fundamental misconception of how this works,so please correct me to the best of your knowledge.)
    I would greatly appreciate it if anyone is able to provide me with an example/sample of how this should be done.
    With Thanks,
    Jord

  • Problem with Calendar and drag and drop a name to a Time spot with palm desktop. Full name does not appear only last name.

    Im having a problem with the palm desktop. When in “Contacts” and I list (LastName,First name) and then I move to the Calendar and drag and drop a name to a Time spot Only the LAST name of the Person appears. How can I fix this so that I can see there full name ?
    Also when If list (Company,Last Name) then go to calendar Some of my contacts are out of order but if I drag and drop them into the calendar day the full name appears. Is there any why of fixing this ? Or having it work properly ?
    Im running  XP pro
    Palm Desktop Version 4.1.4
    Post relates to: Treo 680 (Rogers)
    Message Edited by corrado on 07-21-2008 08:55 AM

    Any Idea how to fix the problem that I am getting when using the (Company,Last Name) and the contacts being out of order in the calander ? I have some last names starting with A then it goes to D then a B then a stack more A and none of then have a Company field filled out in them in them...
    Thanks for looking into that for me but it seems really stange to offer the option but not put in the first name in the calander when you drage the name over. I hope this is fixed in the future. Can anyony sugest another desktop platform I can use if I cant fix my problem with the   (Company,Last Name) problem?
    Post relates to: Treo 680 (Rogers)

  • Drag Drop Event

    Hello All,
    Can I trap the Drag and Drop event of a file from desktop through Scripting for Adobe Bridge.
    Thank you all in advance.
    Regards
    Farzana.

    I haven't seen such an event available to the scripts. I have an event handler and when I turned on my own logging to output all the events that I see, I didn't see any drag/drop events when I tried that operation. That doesn't mean there isn't someother way to do this, but it wasn't obvious to me through normal event handling.
    --John

  • Every time I drag a clip into the events library Final Cut Pro X crashes.

    Every time I drag a clip into the events library Final Cut Pro X crashes.  The import appears to have occured successfully despite the crash as it is in the folder when I reopen FCPX.  But having to restart the program every time I import is annoying and suggests the program is deficient.  The only imports I have tried so far are from iMovie, its sister program.

    Have you tried dumping the preferences file, always my first item when issues arise in the FC family. Second, have you tried different file types? It could be a file issue, FCX not recognizing it (letting you import, but throwing up afterwards).

  • Drag/Drop Proxy Image

    I would like to be able to access the Proxy Image during a
    drag/drop operation inside the DragOver event. Is it possible to
    get refernce to that object to be able to change the image, get
    it's current location, etc?

    1. Using canvas in flash is uncommon, even in Flex its a class that has been replaced by more flexible solutions since flex 4: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/containers/Canvas.ht ml
    2.Shouldn`t your localToGlobal method not starting from canvas ? Instead of image? Not sure how you setup your whole application)
    http://www.orlandmedia.com/blog/tutorials/how-to-use-localtoglobal-in-actionscript-3-0/

  • Drag & Drop a JButton -- URGENT

    I have two Jpanels, one panel contains my set of JButtons and i have to be able drag and place them on the second panel. how much ever i try am unable to do this. I need some help with with what are the flavors i should set. please could someone tell me as soon as possible.
    Thank u

    Hi
    This will Drag the Text 'drag this' from one of the buttons to the panels. not simple but i am sure it will give you the idea.
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.math.*;
    import java.awt.datatransfer.*;
    import java.awt.dnd.*;
    import java.io.*;
    public class TstDrag extends JFrame
         pan   pan1 = new pan();
         pan   pan2 = new pan();
         but   but1 = new but("button 1");
         but   but2 = new but("button 2");
    public TstDrag() 
         getContentPane().setLayout(null);
         setBounds(1,1,600,500);
         addWindowListener(new WindowAdapter()
        {     public void windowClosing(WindowEvent ev)
              {     dispose();
                   System.exit(0);}});
         pan1.setBackground(Color.red);
         pan1.setBounds(1,1,500,200);
         pan2.setBackground(Color.blue);
         pan2.setBounds(1,210,500,200);
         but1.setBounds(10,10,60,20);
         but1.setBounds(10,40,60,20);
         pan1.add(but1);
         pan1.add(but2);
         getContentPane().add(pan1);
         getContentPane().add(pan2);
         setVisible(true);
    public class pan extends JPanel implements DropTargetListener
         DropTarget dropT;  
    public pan() 
         super();
         dropT = new DropTarget(this,this);
    public void dragEnter (DropTargetDragEvent e) 
            System.out.println("dragEnter  my drop");
         e.acceptDrag(e.getDropAction());
    public void dragExit (DropTargetEvent e)
    //        System.out.println("dragExit   drop");
    public void     dragOver(DropTargetDragEvent e)
    public void drop(DropTargetDropEvent e)
              System.out.println( "droped");
         try
              Transferable trans = e.getTransferable();     
              DataFlavor[] dfs   = trans.getTransferDataFlavors();
              String s = (String)trans.getTransferData(dfs[0]);   // this is it
              e.acceptDrop(e.getDropAction());
              e.getDropTargetContext().dropComplete(true);
         catch (IOException exception)
                exception.printStackTrace();
                System.err.println( "Exception" + exception.getMessage());
                e.rejectDrop();
         catch (UnsupportedFlavorException ufException )
                 ufException.printStackTrace();
                 System.err.println( "Exception" + ufException.getMessage());
                 e.rejectDrop();
    public void dropActionChanged(DropTargetDragEvent e )
    public class but extends JButton implements DragSourceListener,
                                                          DragGestureListener
         DragSource dragS = null;
    public but(String s) 
         super(s);
         dragS = new DragSource();
         dragS.createDefaultDragGestureRecognizer(this,DnDConstants.ACTION_COPY_OR_MOVE,this);
    public void dragGestureRecognized( DragGestureEvent e)
         System.out.println( " dragStart");
         StringSelection text = new StringSelection("drag this");
        dragS.startDrag(e, DragSource.DefaultMoveDrop, text, this);
    public void dragDropEnd (DragSourceDropEvent e)
    //       System.out.println( " dragEND");
    public void dragEnter (DragSourceDragEvent e)
    //          System.out.println( " dragEnter");
    public void dragExit (DragSourceEvent et)
    //          System.out.println( "dragExit");
    public void dragOver (DragSourceDragEvent e)
    //          System.out.println( "dragExit");
    public void dropActionChanged ( DragSourceDragEvent e)
    //          System.out.println( "dropActionChanged");
    public static void main (String[] args) throws InterruptedException
         TstDrag fr = new TstDrag();
    }     

  • Strange problem with drag&drop!!

    hello i hope u can help me.
    i have a strange problem but not like the other users with drag&drop in Leopard..
    mine is not exactly like this:
    http://discussions.apple.com/thread.jspa?threadID=1198982&tstart=3538
    i can hold left click and move files but when i need to "drop" them at the .app's window the app rejects the file back! (some of the applications not all!)
    what i mean in examples is:
    i cannot drag&drop anything in the VLC's player window but i can inside the vlc's "controller" window
    i cannot drag&drop a picture in preview
    i cannot drag&drop any file in photoshop's new file/empty canvas
    i cannot drag&drop a mp3 file in itunes but i can drag&drop a full album folder(only in playlist,not in the player window)!
    and i can describe more to show u that it's not about vlc or preview or PS problem, but finder's/leopard problem.
    (i thought in the 1st, that it's vlc's problem and i downloaded a lot of versions!)
    all the other programs works well, for example i can drag&drop a video to final cut or motion
    i can do the same in iMovie (at the space it says"drag&drop media here etc)
    and of course i can drag&drop files to desctop,hard disks etc.
    i can copy/paste text etc (i can copy/paste texti can copy/paste texti can copy/paste texti can copy/paste text)
    i am trying to give you an idea, suggest me what else should i try in order to focus where exactly the problem is!
    i hope u give me a solution cause drag&drop is usefull!
    thank you
    in order to help u, i will describe what i tried so far:
    1)repair permissions
    2)trash com.apple.finder
    3)terminal solution like this: (didn't worked)
    sudo su -
    cd /
    rmdir tmp +*(rmdir: tmp: No such file or directory)*+
    ln -s tmp /private/tmp

    alex74d wrote:
    hello and thanks for your reply
    but why you quote only the part of VLC?
    One thing at a time. Occam's razor.
    and why u believe this is normal?
    i am sure that VLC can drag & drop subtitles or the movie in the player window.
    and when i say sure, i mean 100%
    I disagree. I have tried this since reading your post, on all my VLC versions. It does not work.
    You can, however drop a movie onto the VLC icon in the dock. That works fine.
    RealPlayer accepts a file dropped on it. I just checked it.
    Not all apps accept a file on their output window. Usually only the input window.
    i started my windows bootcamp partition before and i saw this works.
    and i remember trying VLC in tiger a lot of years before, this was ok.
    and yes of course it would be also normal to drop a picture in the photoshop canvas.
    so what is not normal here is my problem, if u can help i'm happy if you cannot please don't confuse it more
    (sorry if i sound "unclear", english is not my 1st languange)
    I will check VLC next time I run Tiger and let you know.
    Message was edited by: nerowolfe

  • Faking Drag&Drop operation to external application

    Hello,
    a rather complicated issue. in my program i have a JTable, and i can drag&drop from this jtable
    to external programs like windows explorer by clicking the mouse and moving it from the table
    to the external program.
    how can i reproduce this exact behaviour WITHOUT user intervention?
    in other words, how can i do this programmatically, creating a drop source at the start point,
    then move the mouse, and release it above a specified location on the screen?
    is this even possible in java (as we're running in a VM) ?

    it has it's problems.
    for example, if the drop point is above the source point, moving the mouse with the robot sometimes marks all entries in the table instead of performing a drag&drop operation. also, it seems that without a delay between the moves, strange things happen. so here is an updated version which workes 99% flawlessly for me.
    package trakker;
    import java.awt.Point;
    import java.awt.Robot;
    import java.awt.event.InputEvent;
    import java.util.logging.Level;
    * this thread fakes a drag & drop operation to the traktor decks
    public class LoadDeckThread implements Runnable
         Point source;          // where was the mouse pointer before operation?
         Point track;          // where is the point of the track in the jlist?
         Point target;          // where do we move the track to?
         // constructor
         public LoadDeckThread(Point pTrack, Point pSource, Point pMoveTo)
              track = pTrack;
              source = pSource;
              target = pMoveTo;
         // thread run
         public void run()
              try
                   // create a new robot
                   Robot robot = new Robot();
                   robot.setAutoDelay(100);
                   // move the mouse to the track in the jlist
                   robot.mouseMove(track.x, track.y);
                   // click and hold
                   robot.mousePress(InputEvent.BUTTON1_MASK);
                   robot.waitForIdle();
                   // move to the left to prevent list scrolling
                   robot.mouseMove(50, target.y);
                   // and to the topleft of our app
                   Point p = Util.mainWnd.getLocation();
                   robot.mouseMove(p.x, p.y);
                   // move the mouse to the specified deck
                   robot.mouseMove(target.x, target.y);
                   // wait some time (otherwise it doesn't work?)
                   //robot.delay(500);
                   robot.waitForIdle();
                   // release the mouse
                   robot.mouseRelease(InputEvent.BUTTON1_MASK);
                   robot.waitForIdle();
                   // move back to the track
                   robot.mouseMove(track.x, track.y);
                   robot.waitForIdle();
                   robot.mousePress(InputEvent.BUTTON1_MASK);
                   robot.mouseRelease(InputEvent.BUTTON1_MASK);
                   // now move back where we were
                   robot.mouseMove(source.x, source.y);
                   robot.waitForIdle();
                   robot = null;
              catch(Exception ex)
                   Util.log("Cannot invoke robot for drag&drop: " + ex.getMessage(), Level.SEVERE);
    } instead of to close tags ;=)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Maybe you are looking for