Newbie question with multiple do drag and drop objects

I am trying to build a drag and drop quiz where you have a list of countries and move the correct country in an empty space in a paragraph to fill properly the sentence (see attachment).
I can get the first country to drag and drop correctly. But when I tried the second country in the list of code, I get the following error message:
"definition of the double function of 1021.
Here is my code:
afghanistan_mc.addEventListener (MouseEvent.MOUSE_DOWN, startDragging);
function startDragging(myevent:MouseEvent):void {}
afghanistan_mc.startDrag ();
}
afghanistan_mc.addEventListener (MouseEvent.MOUSE_UP, stopDragging);
function stopDragging(myevent:MouseEvent):void {}
afghanistan_mc.stopDrag ();
}
burma_mc.addEventListener (MouseEvent.MOUSE_DOWN, startDragging);
function startDragging(myevent:MouseEvent):void {}
burma_mc.startDrag ();
}
burma_mc.addEventListener (MouseEvent.MOUSE_UP, stopDragging);
function stopDragging(myevent:MouseEvent):void {}
burma_mc.stopDrag ();
}
It seems that the problem is that you can't 'startDragging' and "stopDragging" defined in different functions. I saw something on the use of the target property of the MouseEvent object when you have multiple objects drag-and - drop, but I can't find how to do this job.
I would be grateful any advice!

You have functions duplicate definitions.  Either use the same function for the two MCs (startDragging and stopDragging) by putting two eventhandler in each function calls, so you have 2 each, or declare a separate name as startDragging and startDragging2, etc.

Tags: Adobe Animate

Similar Questions

  • Need help with virtual shelf - drag and drop between components?

    Hello

    Im trying to create a virtual shelf, where book spines are clips of individual video that can be dragged and re-ordered on the set.  For the moment I can drag the thorns to a target affected, but not just any target or "nudge" the position of other books along.

    I'm sorry that if that's a little vague I'm not experienced in as3, please do not hesitate to ask any questions and I'll do my best to answer.  IM thinking that a table is necessary which occupies the posts, but I'm not sure how to put it all together!

    Any help is greatly appreciated! The code I have so far is:

    import flash.events.MouseEvent;
    import flash.display.MovieClip;

    var dragArray:Array = [red, blue, green, purple, yellow];
    var matchArray:Array is [target1, target2, target3, target4, target5];.

    var currentClip:MovieClip;
    var startX:Number;
    var startY: number;

    for (var i: int = 0; i < dragArray.length; i ++) {}
    dragArray [i] .buttonMode = true;
    dragArray [i] .addEventListener (MouseEvent.MOUSE_DOWN, item_onMouseDown);
    matchArray [i] .alpha = 0.2;
    }

    function item_onMouseDown(event:MouseEvent):void {}
    currentClip = MovieClip (event.currentTarget);
    startX = currentClip.x;
    startY = currentClip.y;
    addChild (currentClip); bring to front
    currentClip.startDrag ();
    stage.addEventListener (MouseEvent.MOUSE_UP, stage_onMouseUp);
    }

    function stage_onMouseUp(event:MouseEvent):void {}
    stage.removeEventListener (MouseEvent.MOUSE_UP, stage_onMouseUp);
    currentClip.stopDrag ();
    var int index = dragArray.indexOf (currentClip);
    var matchClip:MovieClip = MovieClip (matchArray [index]);
    If (matchClip.hitTestPoint (currentClip.x, currentClip.y, true)) {}
    a match was found. Position the clip on the corresponding clip:
    currentClip.x = matchClip.x;
    currentClip.y = matchClip.y;
    make not draggable:
    currentClip.removeEventListener (MouseEvent.MOUSE_DOWN, item_onMouseDown);
    currentClip.buttonMode = false;
    } else {}
    football match has not, so send the clip to the back where he began:
    currentClip.x = startX;
    currentClip.y = startY;
    }
    }

    Yes, you can double click on activate your movieclips and assign the function double click listeners who use navigateToURL

    dragArray [0] .doubleClickEnabled = true;

    dragArray [0] .addEventListener (MouseEvent.DOUBLE_CLICK, f);

    function f(e:Event):void {}

    navigateToURL (new URLRequest ("http://www.adobe.com"));

    }

  • What's wrong with my muliple drag and drop code?

    I've got ParaA, Perrault and ParaC ( http://img.photobucket.com/albums/v292/pancreasboy/misc/para.gif ) who are dragable mc (ie they have buttons inside them with the code below), they may fall on the mc Para1, Para2 and Para3.

    Here is the code for the button appears:

    on {(press)

    startDrag (this, true);

    This.ox = this ._x;
    This.Oy = this ._y;
    }

    on (release) {}

    stopDrag();

    {
    If (this ._droptarget == ' / Para1 ')

    {
    _root. Para1.gotoAndStop (2);
    }

    If (this ._droptarget == ' / Para2 ")

    {
    _root. Para2.gotoAndStop (2);
    }

    If (this ._droptarget == ' / Para3 ")

    {
    _root. Para3.gotoAndStop (2);
    }

    on the other

    {

    This ._x = this.ox;
    This ._y = this.oy;

    }

    }

    stopDrag ();
    }

    When you drag ParaA all the MC Para1, Para2 or Para3, it executes the relative _root. Para # .gotoAndStop (2); but only clings to the Para3. Did I miss something?

    Thanks in advance.

    The "else" is only for the last 'if', which is the MC para3. So if the target was para1, it always checks the other ' if, and because it is not para3, it will run the "else" and return to the starting point.
    Achieve its connected by adding an 'else' for other targets:
    If (para1) {...}
    ElseIf (para2) {...}
    ElseIf (para3) {...}
    else {...}

    Alternatively, you can use a switch statement:
    switch (this ._droptarget) {}
    case "/ Para1":...
    break;
    case "/ Para2 ':...
    break;
    case "/ Para3:...
    break;
    default:...
    break;
    }

    HTH,
    blemmo

  • How to manage the order of appearance in the target, while drag and drop objects are selected anyway?

    Hello! Hello!

    Oops, I hope you understand my English?

    That's why I tried to show what I have on this photo!

    Secondly, I have to check a list, but we will see that later!

    Captivate Forum.png

    Thank you very much for dedicated to my question:

    Thank you very much

    Nicoolfly

    You need to apply normal effects of the actions, I don't think there are available in the D & D interactive configuration. Captivate scale effects, glow, glow twice, blinking eyes and many others but Configurator of the of must.

  • Drag and Drop with DataGrid to Image

    Hi all

    I have experimented with drag and drop between DataGrids. It was pretty simple, but what I want is to take a line from a DataGrid and drop it on an Image. Can I use or overlap the DataGrid drag and drop with a manual drag and drop for the Image? Or should I manually add the drag and drop only?

    I guess I'm just trying getting the Image to accept the line of the data grid.

    Hello

    Yes, you can interwine the two. I did something similar, except in my case I
    working with a datagrid and a tree and I need to override the default behavior for the tree.

    Just use dragEnabled = "true" to the datagrid control.

    Then the Image to define functions for the dragEnter and dragDrop events (and from other events, drag if you wish).

    private void doEnter(event:Event):void
    {
    DragManager.acceptDragDrop (Image (event.currentTarget));
    }

    private void doDrop(event:Event):void
    {
    your code here
    }
    Don't forget to add:
    Import mx.managers.DragManager;

  • Drag and drop - moved outside the target object

    Hello

    It's my first drag and drop object.  It went pretty well except for nitpicking a few things.  I'm hoping to get help on one of these.

    A sample of my screen is below.  The basic idea is that you drag one of the words in the dotted box, and I'll give you a sound feedback, whether good or bad.  I'm tiling the answers and this is my question.  Sometimes, if I already have one correct answer in the box and drag each other directly on the existing answer, he'll put it on the side and it seems that it is in the next box.  An example is below.  This happens very rarely, but I still want to go to the bottom of it.  I resized the boxes, made the smaller font and I reduce the size of the response when he goes inside the box.  But it still exists.  If they hang out below the existing response response then it works fine.  Does anyone know what is the answer?  I have the screen below, as well as the settings of the target in the example below that.  any help would be greatly appreciated.  Thank you!

    dnd question.gif

    target settings.gif

    That's the problem with tiling. You can reduce the size of drop even more (90%), try one of the other options in the second row of tiles. Or choose absolute, which means that it has no real alignment, control, but text will stay where the user puts.

  • Several Drag and Drop, several targets. CS5

    Hello:

    I do a Multiple of Drag and Drop in several objectives educational puzzle for child 6-7 years trying to teach them a little on which plants grow in environments in the country. So I have a map of the Mexico divided into 3 different areas: desert, forest and tropic and 6 different plants (3 different groups: cactus, pine and tropical flowers, 2 of each) scattered across the stage and around the map. The goal is for children to put plants in the box to the right and then click on "check" button, which triggers a validation process. Each video clip of the plant has 2 frames with a stop(); action on all: the graph of the plant extends on both images and the second picture has a red sign error graphic that indicates an error occurred (if this is the case). Then the validation process triggered by the "check" button is supposed to move the playback cursor in each placed wrongly move clip factory for the second image to show what plants are displaced and move the playhead of the main timeline to a picture that contains a "Please try again" text and a button "restart Puzzle." If the answers are good, an animation plays saying it was VERY WELL DONE! .

    I searched the Internet for some tutorials and found a file which is pretty close to what I need. I tried to adapt the code to my puzzle but failed miserably. The file is here if you want to check (scroll to the bottom of the page, it is called Soldier.fla). I'm not sticking the code here because it is VERY long, but I will if necessary. If you want that I download the files somewhere else and link them here, I will. If you need me to send them, I'll be happy.

    Here is the structure and instance names in my file:

    Departure:

    -Intro animation

    Map:

    -3 video clips: target_1, target_2 and target_3.

    -Each movie clip has two executives with a stop(); action on each.

    -Each movie clip has a frame-by-frame with a color change to show when a clip of plant fell on her.

    Plants:

    -6 video clips: drag_1, drag_2, drag_3, drag_4, drag_5 and drag_6.

    -Each movie clip has two executives with a stop(); action on each.

    -Each video clip has an invisible button in its background layer called dragbutton1 to dragbutton6 respectively.

    -In the second frame of each clip, I placed a sign of error to be displayed when the boy dropped the clip in the wrong target.

    Placement:

    -video clips drag_1 and drag_3 must be embedded in the target_1.

    -video clips drag_2 and drag_4 must be embedded in the target_2.

    -video clips drag_5 and drag_6 must be embedded in the target_3.

    Buttons:

    -Puzzle AutoScan: main playhead moves to an image named 'play '. It shows after the Intro animation.

    -Check the button: Validation process. If there is any mistakes sends the playhead to main to a named 'wrong' image (here is the text of "Please try" again). If there is no error, sends the playhead to main to a framework called 'good' where begins the animation "Very well done". It shows when start the puzzle.

    -Restart the Puzzle button: moves the main playback head to frame of 'Play '. It shows when start the puzzle.

    -Start button: just restarts. It shows after "Very well done" animation.

    Phew, it was long!

    Now, I'm not a programmer, I'm a designer. I can do buttons and other small things very simplistic but it's just out of my League. Programmers do things my office like PHP (Wordpress, Joomla), a few JS and things like that, but they don't do any ActionScript. They are trying to help but let drop the ball and I tried to understand this since Friday (I took this as a challenge and he lost). The customer wants in AS2, but if you can help me in AS3, screw the customer!

    If one of you can help me with the code, or point me to the right place, I'll be in debt to you. Forever.

    Thank you very much.

    This is a typo and should be:

    var dragA:Array = [drag_1, drag_2, drag_3, drag_4, drag_5, drag_6];

    for (var i: Number = 0; i<>

    [i] dragA dragA [i] ._x = .startX;

    [i] dragA .startY dragA [i] ._y =

    If (i == 0 |) I == 2) {}

    dragA [i] .target = target_1;

    } else if (i == 1 |) I == 3) {}

    Dropped [i] .target = target_2;

    } else {}

    Dropped [i] .target = target_3;

    }

    {dragA [i] .onPress = function ()}

    this.startDrag ();

    }

    dragA [i] .onRelease = function () {}

    this.stopDrag ();

    checkTarget (this);

    }

    }

    function checkTarget(drag_mc:MovieClip):Void {}

    {if (drag_mc. HitTest (drag_mc. Target))}

    feedback. Text = "done Well! »

    } else {}

    feedback. Text = "Missed";

    drag_mc._x = drag_mc.startX;

    drag_mc._y = drag_mc.startY;

    }

  • Drag and drop the library not workingf

    I placed a number of graphics (.ai .ps, .eps, .pdf etc.) in a CC library. When Im in InDesgn I can see the items in the library, but when I try to drag and drop them on an open page, I get a message saying "the file does not exist or the file may be in use by another application."

    I've restarted the computer and only Indesign open so that the files are not in use.  The library icons next to the items. I can double click and use goods have been placed in InDesign, but the files in photoshop or Illustrator won't drag-and - drop or double click for use in InDesign.

    Is this to say that I cannot use InDesign created elements of library in InDesign and photoshop only elements in Photoshop etc. ?

    Carl

    I have the same problem

    I repeatedly appealed to tech support, but they couldn't help

    I solved the problem in this way:

    1. launch InDesign

    2 - Open a new document

    3 to drag and drop objects from the library CC

    4. I read the error message :-((()

    5. I swear :-)

    6. close InDesign

    7 - Repeat the pp. 1-3

    7A - if this does not work, I have to open Illustrator object and drag-and - drop library in Illustrator. And then I repeat s. 1-3

  • Drag and Drop Tagets

    I know the location and size of the drag and drop objects are very sensitive to 7 Captivate. I have targets that do not overlap each other and they are larger than the objects to slide 20 pixels. The interaction is not always a correct answer. The filling of the affected area is 0 and the position of the snap is absolute. Drag objects and targets are intelligent forms.

    I can provide the Captivate file if anyone is willing to look at.

    I'm sorry.  Please mark this thread as answered then.

  • Newbie request for assistance with several drag-and-drop &amp; multiple targets

    I know that this question has been asked a million times, but I get always very well the solution.  I know that the solution called for me the use of tables in a part of my code, but I have problems understanding how to implement it.  I use Flash CS 5.5 with AS3.

    I have a flash drag-and-drop file which is divided into 4 distinct zones on the stage.  On each box, there are 7 places, for 7 different "puzzle pieces".  The first two spaces on each quadrant have very a very specific order for the correct puzzle pieces, while the 5 additional places on each quadrant also have specific parts, but the order is not important.  I have included my code below for reference (note that I have not all instances, finished yet).

    Basically, in code that's been created, the following bodies have specific targets with specific command:

    D1_1_mc, D1_2_mc, D1_1_mc, D2_2_mc, D3_1_mc, D3_2_mc, D4_1_mc and D4_2_mc.

    All other instances, such as D1_3_mc, D2_3_mc, D2_4_mc, etc. have specific quadrants on which they need to fall, but what about the last 5 'spaces' in each quadrant, the order does not matter.  I know that I can continue to do what I do, but I would have preferred that the last 5 pieces on each quandrant do not have to be in a specific order.

    You can provide any assistance is greatly appreciated!

    var startX:Number;

    var startY: number;

    var counter: Number = 0;

    D1_1_mc.addEventListener (MouseEvent.MOUSE_DOWN, Pick-up);

    D1_1_mc.addEventListener (MouseEvent.MOUSE_UP, dropIt);

    D1_2_mc.addEventListener (MouseEvent.MOUSE_DOWN, Pick-up);

    D1_2_mc.addEventListener (MouseEvent.MOUSE_UP, dropIt);

    D1_3_mc.addEventListener (MouseEvent.MOUSE_DOWN, Pick-up);

    D1_3_mc.addEventListener (MouseEvent.MOUSE_UP, dropIt);

    D2_1_mc.addEventListener (MouseEvent.MOUSE_DOWN, Pick-up);

    D2_1_mc.addEventListener (MouseEvent.MOUSE_UP, dropIt);

    D2_2_mc.addEventListener (MouseEvent.MOUSE_DOWN, Pick-up);

    D2_2_mc.addEventListener (MouseEvent.MOUSE_UP, dropIt);

    D2_3_mc.addEventListener (MouseEvent.MOUSE_DOWN, Pick-up);

    D2_3_mc.addEventListener (MouseEvent.MOUSE_UP, dropIt);

    D2_4_mc.addEventListener (MouseEvent.MOUSE_DOWN, Pick-up);

    D2_4_mc.addEventListener (MouseEvent.MOUSE_UP, dropIt);

    D3_1_mc.addEventListener (MouseEvent.MOUSE_DOWN, Pick-up);

    D3_1_mc.addEventListener (MouseEvent.MOUSE_UP, dropIt);

    D3_2_mc.addEventListener (MouseEvent.MOUSE_DOWN, Pick-up);

    D3_2_mc.addEventListener (MouseEvent.MOUSE_UP, dropIt);

    D3_3_mc.addEventListener (MouseEvent.MOUSE_DOWN, Pick-up);

    D3_3_mc.addEventListener (MouseEvent.MOUSE_UP, dropIt);

    D4_1_mc.addEventListener (MouseEvent.MOUSE_DOWN, Pick-up);

    D4_1_mc.addEventListener (MouseEvent.MOUSE_UP, dropIt);

    D4_2_mc.addEventListener (MouseEvent.MOUSE_DOWN, Pick-up);

    D4_2_mc.addEventListener (MouseEvent.MOUSE_UP, dropIt);

    D4_3_mc.addEventListener (MouseEvent.MOUSE_DOWN, Pick-up);

    D4_3_mc.addEventListener (MouseEvent.MOUSE_UP, dropIt);

    D4_4_mc.addEventListener (MouseEvent.MOUSE_DOWN, Pick-up);

    D4_4_mc.addEventListener (MouseEvent.MOUSE_UP, dropIt);

    function pickUp(event:MouseEvent):void {}

    event.target.startDrag (true);

    reply_txt. Text = "";

    event.target.parent.addChild (event.target);

    startX = event.target.x;

    startY = event.target.y;

    }

    function dropIt(event:MouseEvent):void {}

    event.target.stopDrag ();

    var myTargetName:String = "target_" + event.target.name;

    var myTarget:DisplayObject = getChildByName (myTargetName);

    If (event.target.dropTarget! = null & & event.target.dropTarget.parent == myTarget) {}

    reply_txt. Text = "Good Job!"

    event.target.removeEventListener (MouseEvent.MOUSE_DOWN, Pick-up);

    event.target.removeEventListener (MouseEvent.MOUSE_UP, dropIt);

    event.target.buttonMode = false;

    Event.Target.x = myTarget.x;

    Event.Target.y = myTarget.y;

    counter ++;

    } else {}

    reply_txt. Text = "Try Again!";

    Event.Target.x = startX;

    Event.Target.y = startY;

    }

    if(Counter == 5) {}

    reply_txt. Text = "congratulations, you did!"

    }

    }

    D1_1_mc.buttonMode = true;

    D1_2_mc.buttonMode = true;

    D1_3_mc.buttonMode = true;

    D2_1_mc.buttonMode = true;

    D2_2_mc.buttonMode = true;

    D2_3_mc.buttonMode = true;

    D2_4_mc.buttonMode = true;

    D3_1_mc.buttonMode = true;

    D3_2_mc.buttonMode = true;

    D3_2_mc.buttonMode = true;

    D4_1_mc.buttonMode = true;

    D4_2_mc.buttonMode = true;

    D4_3_mc.buttonMode = true;

    D4_4_mc.buttonMode = true;

    Since it seems to afew possible gaps in the code you showed, and what I offer myself in response to your questions, I spent a little time get a working model of what I guess you just using the three targets and the fall of four objects.  If you want, I can make the file available for you, but for now, here's the code that works...

    var startX:Number;
    var startY: number;
    var counter: Number = 0;

    target_D2_1_mc.allowed = new Array (D2_1_mc);
    target_D2_2_mc.allowed = new Array (D2_2_mc);
    target_D2_3_mc.allowed = new Array (D2_3_mc, D2_4_mc);

    D2_1_mc.addEventListener (MouseEvent.MOUSE_DOWN, Pick-up);
    D2_1_mc.addEventListener (MouseEvent.MOUSE_UP, dropIt);
    D2_2_mc.addEventListener (MouseEvent.MOUSE_DOWN, Pick-up);
    D2_2_mc.addEventListener (MouseEvent.MOUSE_UP, dropIt);
    D2_3_mc.addEventListener (MouseEvent.MOUSE_DOWN, Pick-up);
    D2_3_mc.addEventListener (MouseEvent.MOUSE_UP, dropIt);
    D2_4_mc.addEventListener (MouseEvent.MOUSE_DOWN, Pick-up);
    D2_4_mc.addEventListener (MouseEvent.MOUSE_UP, dropIt);

    function pickUp(event:MouseEvent):void {}

    reply_txt. Text = "Good Luck."
    event.target.startDrag (true);
    event.target.parent.addChild (event.target);
    startX = event.target.x;
    startY = event.target.y;
    }

    function dropIt(event:MouseEvent):void {}

    event.target.stopDrag ();

    If (event.target.dropTarget! = null & MovieClip (event.target.dropTarget.parent).allowed.indexOf (event.target) >-1) {}
    reply_txt. Text = "Good Job!"
    event.target.removeEventListener (MouseEvent.MOUSE_DOWN, Pick-up);
    event.target.removeEventListener (MouseEvent.MOUSE_UP, dropIt);
    event.target.buttonMode = false;
    Event.Target.x = MovieClip (event.target.dropTarget.parent) .x;
    Event.Target.y = there MovieClip (event.target.dropTarget.parent);
    counter ++;
    } else {}
    reply_txt. Text = "Try Again!";
    Event.Target.x = startX;
    Event.Target.y = startY;
    }

    if(Counter == 5) {}
    reply_txt. Text = "congratulations, you did!"
    }
    }

    D2_1_mc.buttonMode = true;
    D2_2_mc.buttonMode = true;
    D2_3_mc.buttonMode = true;
    D2_4_mc.buttonMode = true;

  • Problem with drag and drop multiple lines of ListView

    I work on an example application with 2 views of list that is the players and the team and implement drop and drop as players can be deposited to one list to the other. Everything works as expected when there is selection unique model is enabled in the source list view. However, if I have activated several model selection and drag 2 or more lines of source target list view list view, see the following exception after that the decline is over.

    Exception:

    java.lang.IllegalArgumentException: only objects serializable or ByteBuffer can be used as data with the format of data [subListPlayers]

    at com.sun.javafx.tk.quantum.QuantumClipboard.putContent(QuantumClipboard.java:513)

    at javafx.scene.input.Clipboard.setContent(Clipboard.java:230)

    (1) what should be the DataFormat used to be able to drag and drop multiple lines? Looks like we don't have for the type of object, so I created the following which does not solve the problem.

    private DataFormat dataFormat = new DataFormat ("subListPlayers");

    (2) I made changes to support serialization on the data object that seems no more to solve the problem. Tried by implementing the interface Serializable, as well as the implementation of the Externalize interface.

    Can someone Guide please if there is an easy way to implement this behavior?

    Code:

    
    

    public class player

    {

    private String name;

    public player (String name)

    {

    myIdName = name;

    }

    public String getName()

    {

    return the name.

    }

    public void setName (String name)

    {

    myIdName = name;

    }

    @Override

    public boolean equals (Object o)

    {

    If (this == o) return true;

    If (o == null | getClass()! = o.getClass ()) return false;

    A player = o (player);

    If (name! = null? name.equals (player.name): player.name! = null) return false;

    Returns true;

    }

    @Override

    public int hashCode()

    {

    return the name of! = null? name.hashCode (): 0;

    }

    }

    SerializableAttribute public class JavaFXDnDApplication extends Application

    {

    private final static ListView < drive > playersListView = new ListView < drive > ();

    private final static ObservableList < drive > /playerslist is FXCollections.observableArrayList ();.

    private final static ListView < drive > teamListView = new ListView < drive > ();

    private final static GridPane rootPane = new GridPane();

    private DataFormat dataFormat = new DataFormat ("subListPlayers");

    Public Shared Sub main (String [] args)

    {

    Launch (args);

    }

    @Override

    public void start (point primaryStage)

    {

    primaryStage.setTitle ("Drag and Drop Application");

    initializeComponents();

    initializeListeners();

    buildGUI();

    populateData();

    primaryStage.setScene (new scene (rootPane, 400, 325));

    primaryStage.show ();

    }

    Private Sub initializeListeners()

    {

    playersListView.setOnDragDetected (new EventHandler < MouseEvent >)

    {

    @Override

    public void handle (event MouseEvent)

    {

    System.out.println ("setOnDragDetected");

    Dragboard dragBoard = (TransferMode.MOVE) playersListView.startDragAndDrop;

    ClipboardContent content = new ClipboardContent();

    content.putString (playersListView.getSelectionModel () .getSelectedItem () .getName ());

    Content.put (dataFormat, playersListView.getSelectionModel () .getSelectedItems ());

    dragBoard.setContent (content);

    }

    });

    teamListView.setOnDragOver (new EventHandler < DragEvent >)

    {

    @Override

    public void handle (DragEvent dragEvent)

    {

    dragEvent.acceptTransferModes (TransferMode.MOVE);

    }

    });

    teamListView.setOnDragDropped (new EventHandler < DragEvent >)

    {

    @Override

    public void handle (DragEvent dragEvent)

    {

    String player = dragEvent.getDragboard () .getString ();

    ObservableList < drive > drive = dragEvent.getDragboard () .getContent (dataFormat) (< drive > ObservableList);

    String player = dragEvent.getDragboard () .getString ();

    teamListView.getItems () .addAll (New Player (player));

    playersList.remove (new Player (player));

    dragEvent.setDropCompleted (true);

    }

    });

    }

    Private Sub buildGUI()

    {

    rootPane.setGridLinesVisible (true);

    rootPane.setPadding (new Insets (10));

    rootPane.setPrefHeight (30);

    rootPane.setPrefWidth (100);

    rootPane.setVgap (20);

    rootPane.setHgap (20);

    rootPane.add (playersListView, 0, 0);

    rootPane.add (teamListView, 1, 0);

    }

    Private Sub populateData()

    {

    () playersList.addAll

    New Player("Adam"), New Player("Alex"), Player ("Alfred") New Player("Albert") new,.

    New Player("Brenda"), New Player("Connie"), Player ("Derek") new new Player ("Donny").

    Player ("Lynne") new, New Player ("Myrtle"), Player ("pink") New Player("Rudolph") new,.

    Player("Tony") new, New Player ("Trudy"), Player ("Williams") New Player ("Zach") new

    );

    playersListView.setItems (playersList);

    }

    Private Sub initializeComponents()

    {

    playersListView.setPrefSize (250, 290);

    playersListView.setEditable (true);

    playersListView.getSelectionModel () .setSelectionMode (SelectionMode.MULTIPLE);

    playersListView.setCellFactory (new reminder < < drive > ListView, ListCell < drive > > ())

    {

    @Override

    public call for ListCell < drive > (ListView < drive > playerListView)

    {

    return again ListCell < drive >)

    {

    @Override

    protected void updateItem (player, boolean b)

    {

    super.updateItem (reader, b);

    If (player! = null)

    {

    setText (player.getName ());

    }

    }

    };

    }

    });

    teamListView.setPrefSize (250, 290);

    teamListView.setEditable (true);

    teamListView.getSelectionModel () .setSelectionMode (SelectionMode.MULTIPLE);

    teamListView.setCellFactory (new reminder < < drive > ListView, ListCell < drive > > ())

    {

    @Override

    public call for ListCell < drive > (ListView < drive > playerListView)

    {

    return again ListCell < drive >)

    {

    @Override

    protected void updateItem (player, boolean b)

    {

    super.updateItem (reader, b);

    If (player! = null)

    {

    setText (player.getName ());

    }

    }

    };

    }

    });

    }

    }

    
    

    Yes, it is a pain. I filed https://javafx-jira.kenai.com/browse/RT-29082 earlier. Go ahead and vote in favour if you're inclined...

    I think that the problem in your case, it is the observable list provided by MultipleSelectionModel.getSelectedItems () is not serializable. So even if you make your player Serializable class, the list is not. The first thing I would try, I think, is to make player implements Serializable and pass in an ArrayList instead of the observable list. If you can do

    content.put(dataFormat, new ArrayList(playersListView.getSelectionModel().getSelectedItems()));
    

    and

    List player = (List) dragEvent.getDragboard().getContent(dataFormat);
    teamListView.getItems().addAll(player);
    

    If it does not, a solution is simply to store the "slipped" into a property list:

    final ListProperty draggedPlayers = new SimpleListProperty();
    //...
    // Drag detected handler:
    content.putString("players");
    draggedPlayers.set(playersListView.getSelectionMode().getSelectedItems());
    
    // Drag dropped handler:
    if (dragboard.hasString() && dragboard.getString().equals("players")) {
         teamListView.getItems().addAll(draggedPlayers.get());
         draggedPlayers.set(null);
    }
    
  • Add Drag and Drop Quiz question

    Hello

    I'm a complete newbie to Adobe captivate.

    Can someone help me with the addition of a Drag and Drop issue a standard set of Quiz questions, so he gets calculated as a total score?

    Thank you!

    & Sliding is interactive, which means that, in the properties panel, you will see the accordion Reporting. There, you can attach a note and check the option Add to the Total. The score will be automatically added to the quiz variables system.

  • MovieClip only, Drag and Drop to multiple targets

    So I've been sitting for the last few hours trying to search the Web for solutions to be able to drag and drop a MovieClip between multiple targets. I have no idea and I am struggling to find something that will help me with this. This is for a class assignment slide / move and I would like to help, please let. This is the general pattern.

    The scene is a multiple-choice questionnaire. There are 3 statements aligned next to 3 boxes, these are my targets. A movieclip appears in the corner, that's the question I want to activate him drag / drop in one of the 3 targets. These targets are named separately as target1_mc, target2_mc and target3_mc. The movieclip that is the 'selector' for the multiple choice is named selector_mc.

    I only know the basic drag and drop the script that has been taught in class, but it's only for one target, not 3. A picture has been provided below. Again, selector_mc is the blue square in the upper part of the screen. Targets (target1_mc, target2_mc, target3_mc) are on the right side of the screen. I want to leave this blue square to be able to drag and drop on targets and areas nod to one of them, invoking a response to it.

    Capture.PNG

    selector_mc.origX = selector_mc._x;

    selector_mc.origY = selector_mc._y;

    {selector_mc.onPress = Function ()}

    this.startDrag ();

    }

    {selector_mc.onRelease = Function ()}

    this.stopDrag ();

    {if (Eval (this._droptarget) == target1_mc)}

    do something. Red Dragon has been selected

    This ._x = target1_mc._x;

    This ._y = target1_mc._y;

    } else

    {if (Eval (this._droptarget) == target2_mc)}

    do something. White Dragon has been selected

    This ._x = target2_mc._x;

    This ._y = target2_mc._y;

    } else

    {if (Eval (this._droptarget) == target3_mc)}

    something.blackdragon has been selected

    This ._x = target3_mc._x;

    This ._y = target3_mc._y;

    } else {}

    all lack em

    This ._x = this.origX;

    This ._y = this.origY;

    }

    }

  • Drag and drop question - Desktop and USB

    Hello!!

    I have an Asus laptop that I bought in September with Windows 8 is installed. I saw drag and drop questions on desktop lately, and I'll provide you with a full run down of what past:

    1. this particular case, I wanted to save my mobile by copying and pasting all the files from my phone to a USB (USB Kingston).

    2. I selected all files, right click to copy, open the folder that I made in the USB for my phone content and do a right-click Paste.

    3. nothing's happened, Explorer seems to have frozen, so I opened the Task Manager and press end task, all closed and restarted my laptop.

    4. I have excluded that my phone was the issue. I was able to create a folder on my desktop and copy and paste all of the content of my phone in the folder on my desktop.

    5. I tried to copy and paste / drag and drop an image from my office to the flash drive. Explorer Windows freezes on the rise again.

    6. I tried another flash drive. Explorer Windows froze again.

    Apparently I'm unable to copy files ON a USB key, which makes the backup and backup of things a headache because Windows Explorer stops working every time.

    I am the only user of this laptop, and I don't know what is happening or what to do. Any help would be appreciated. Windows 8.1 upgrade would solve this problem?

    Hi Karthik,

    1. There is no error message.

    2. I tried earlier drag - move my documents to my flash drive and it works perfectly.

    I just tried again to drag and drop from my office to my flash drive and for some reason, it works again.

    I don't think that was with my flash drives, but with Windows Explorer itself. Nevertheless, it seems to have fixed itself somehow. Thank you very much for your help!

  • Drag-and-drop questions: arranged randomly moveable elements

    I suspect that the answer is 'no', but maybe an expert could confirm: it is possible to produce a drag-and-drop quiz, in which the movable elements are arranged at random at the beginning of the quiz? The purpose is to ensure that students can not cheat so easily...

    As an alternative, it is possible to create two or three different drag-and-drop (each quiz on a transparency) and quizzes randomly present the student with one of these slides / quiz? I realize other messages than drag-and-drop is not compatible with question pools. I think here is a random, random, blade issues as such.

    The answers would be appreciated.

    I don't think that your first scenario is possible, but I'm not an expert on JS, nor that I have experienced enough with this new accessory CPExtra. However with a good Setup, cheating is not as simple as that for D & D.

    Second scenario seems possible: you can easily generate a random number (example: between 45 and 47 if your slides D & D have these numbers) and use this number for navigation. Of course, you will need to take into account that all navigation will have to be customized (not), because you will need to avoid the other 2 slides are visited. It also means that you need to turn on branch conscious of having to fix the score at the end because the score of the D & D 3 slides will be present in the Total score. Indeed, question pools are not possible for D & D.

Maybe you are looking for