Drag and drop interaction - logical flaw

Hello

I hope help to smooth out this little piece of code. My logic is somehow screwed up.

I have 10 clips and 10 targets. The user is dragging the clips for targets, and when dropped on a target, the clip locks in place at the x and the y coord of the target.


The code below allows the user to drop the clip onto its corresponding target; that is to say:

-droppedClip1 can only be dropped on hitTarget1
-droppedClip2 can only be dropped on hitTarget2
-etc.

How can I change the code so that the droppedClip can be placed on any of the 10 targets?

Ty for any help,
~ chipleh

//droppedClip = movie clip the user just dropped
//totalClips = total number of draggable clips
function evaluateDroppedClip(droppedClip:Object,totalClips:String):void
{ 
 for (var i:Number = 0;i<Number(totalClips);i++)
 {
  var hitTarget:Object = objectContainer.getChildByName("hitTarget" + i);       
  if(droppedClip.hitTestObject(hitTarget))  
  {           
   trace("hitTarget = " + hitTarget.name);            
   droppedClip.x = hitTarget.x;
   droppedClip.y = hitTarget.y;      
  }else{
   droppedClip.x = droppedClip.xPos;//the original position of the dropped clip
   droppedClip.y = droppedClip.yPos;//the original position of the dropped clip   
  }
 }
}


I did not try to interpret what your additional coding is trying to accomplish.  Your original publication aims to allow an object slipped to be dropped on a target and stick.  So I'd head back to what you did initially and start here with what I already offered.  Assign a property to each of your targets, name it 'isTarget' or something and set it to true.  If the target isTarget property is true, and if so, leave this field then test in the first conditional.

Tags: Adobe Animate

Similar Questions

  • How can I register a message of success to a drag and drop interaction - I don't see this option in the Actions on the possibilities of success and it cannot know?

    How can I register a message of success to a drag and drop interaction - I don't see this option in the Actions on the possibilities of success and it cannot know?

    Hide you this way:

  • Drag and drop interaction failure captions

    I have a drag and drop interaction with a target drop and drag several objects. Slip that one object is the right answer. When the learner moves an incorrect object drag the drag target I want a legend of failure - which is quite simple. However, I want a capture of failure for each of the objects dragged badly so that there is another explanation for why each item is indefensible. Then I need a legend of success for when the object correct drag is dragged to the drop target.

    Is this possible?

    Hi Jay,.

    Yes, could create such a scenario, but the button send is not used in this case, because the feedback will appear immediately when a drag object on the target. Is it OK?

    Here the workflow:

    • In addition to the object, set all comments container of text you need, correct and incorrect and label them so that they are easily recognizable. I scored FB_1, FB_2... because my objects were decline.1, Drop2...
    • Make these initially invisible feedbacks and group them in Gr_FB
    • Create drag & drop in the normal way with a correct link
    • Select the target and in the in the Panel D & D, click the button I agree to change the settings like this
    • Advanced actions are fairly simple, standard, with two instructions: Gr_FB hide and show FB_n (with the container of appropriate feedback - you cannot use Shared actions in this dialog box).
    • In the D & D Panel, choose infinite for the number of retries and uncheck the legend of failure.

    Lilybiri

  • Widget Infosemantics Drag and Drop Interactive

    I added the Infosemantics Drag and Drop Interactive widget to my project, but it works only after the publication by a computer and not on an iPad.  I've published using SWF and HTML5, so it "should" work. The HTML Tracker for this slide does not list the blades not taken in charge or objects.  If this widget is not compatible with the iPad, is the new drag and drop feature Captivate available for subscription customers and ASA work on an iPad?  If so, is there a student for ASA or a subscription fee? Thank you very much.

    No, the widget drag / move does not work on your iPad.  No Infosemantics widget is compatible with HTML5 output at this time.  Forgot to widgets, HTML5 Tracker be not necessarily compatible, so it is not a good guide in this instance.

    Captivate 6.1 drag and drop feature works (somehow) in HTML5.  I suggest that you go down that road.

  • Text comments for support of Drag and Drop Interaction

    I developed a drag and drop interaction that works well, the problem is with the behavior of the reset button send.

    If the objects of slide 'proper' are on the 'right' target - no problem

    The problem is if a combination of drag-and-drop 'wrong' is selected, displays the text 'wrong' feedback and the reset button moves all drag the object to the starting position, but once that the 'good' drag drop combination is submitted, the 'wrong' feedback text appears.

    The fla is available here: skydrive.live.com/?cid=bb539b6eff0afbf5 & sc = documents & uc = 1 & id = BB539B6 EFF0AFBF5% 21114 #

    Thanks in advance for any help/suggestions, you can provide and for taking the time to read this post

    The corresponding code is:

    Section 1:

    ActionScript code:

     

    function dragSetup(clip, targ) { clip.onPress = function() { startDrag(this); this.beingDragged=true; }; clip.onRelease = clip.onReleaseOutside=function () { stopDrag(); this.beingDragged=false; if (eval(this._droptarget) == targ) { this.onTarget = true; _root.targ.gotoAndStop(2); } else { this.onTarget = false; _root.targ.gotoAndStop(1); } }; //the variables below will store the clips starting position clip.myHomeX = clip._x; clip.myHomeY = clip._y; //the variables below will store the clips end position clip.myFinalX = targ._x; clip.myFinalY = targ._y; clip.onEnterFrame = function() { //all these actions basically just say "if the mouse is up (in other words - the clip is not being dragged) // then move the MC back to its original starting point (with a smooth motion)" if (!this.beingDragged && !this.onTarget) { this._x -= (this._x-this.myHomeX)/5; this._y -= (this._y-this.myHomeY)/5; //if the drag object is dropped on any part of the target it slides to the center of the target } else if (!this.beingDragged && this.onTarget) { this._x -= (this._x-this.myFinalX)/5; this._y -= (this._y-this.myFinalY)/5; } }; } dragSetup(drag1,drop1); dragSetup(drag2,drop2); dragSetup(drag3,drop3); dragSetup(drag4,drop4); dragSetup(drag5,drop5); dragSetup(drag6,drop6); dragSetup(drag7,drop7);

     

    on the submitBtn:

    ActionScript code:

     

    on (press) {     if ((_root.drag1._droptarget == "/drop1") &&         (_root.drag2._droptarget == "/drop2") &&         (_root.drag3._droptarget == "/drop3") &&         (_root.drag4._droptarget != "/drop4") &&         (_root.drag5._droptarget != "/drop5") &&         (_root.drag6._droptarget != "/drop6") &&         (_root.drag7._droptarget != "/drop7"))     {         {             resetBtn.enabled = false;         };         {             feedbackTxt = "Yes, hardware installation, asset tagging and imaging are the best services to recommend to help your customer meet her deadline.";         };         {             drag1.enabled = false;             drag2.enabled = false;             drag3.enabled = false;             drag4.enabled = false;             drag5.enabled = false;             drag6.enabled = false;             drag7.enabled = false;         };     }     else     {         feedbackTxt = "Not quite.  At least one of services you chose isn't the best recommendation, or you did not chose all of the correct services.  Consider your customers business needs, click Reset and try again.";         gotoAndPlay("Scene 1", 1);     } }

     

    on the resetBtn:

    ActionScript code:

     

    //this code controls the reset button function and returns all of the drag objects to the start position. on(Press) {  drag1.onTarget=false; drag1._x = drag1.myHomeX; drag1._y = drag1.myHomeY;  drag2.onTarget=false; drag2._x = drag2.myHomeX; drag2._y = drag2.myHomeY;  drag3.onTarget=false; drag3._x = drag3.myHomeX; drag3._y = drag3.myHomeY;  drag4.onTarget=false; drag4._x = drag4.myHomeX; drag4._y = drag4.myHomeY;  drag5.onTarget=false; drag5._x = drag5.myHomeX; drag5._y = drag5.myHomeY;  drag6.onTarget=false; drag6._x = drag6.myHomeX; drag6._y = drag6.myHomeY;  drag7.onTarget=false; drag7._x = drag7.myHomeX; drag7._y = drag7.myHomeY;  feedbackTxt = ""}

     

    include your onTarget in the if statement, not only 3 of them.

  • Hyperlink button doesn't work is not a Drag and Drop Interaction

    I have an interaction drag-and - drop on the last slide of a project that work very well, but my button (arrow)

    that goes to a site Web does not work (nothing happens when the user clicks the button).  Button actions
    are defined as follows: success: open URL or file, check of the infinite attempts and URL is set to
    on new.

    Thanks for the tips.

    Kelvin

    Drag and Drop.png

    Haven't you set up your network drive as a trusted location in your security settings for Flash?  If this isn't the case, it will be the reason.  If that's how you want to deliver your learning (from a network drive), then anyone who consumes it will to do this. If things don't work out as planned.  A road LAN network is NOT a web server.

  • Captivate 8 drag and drop interaction does not

    Hi, I work with 8 Captivate and created an interaction drag-and - drop using the wizard to drag / move. For some reason when I preview the interaction some of my sources of drag and others are not. I searched high and low for what I can hurt, but I can not understand. I created types when doing the interaction so it is not sensible that some should work and others don't. Thanks for any help you can provide.

    Hi Vaneppmc1,

    You have disabled the option accept all of the dialog "drag accepted Source. (as seen from your capture screen images).

    If the option "accept all the" is checked, the target can accept 'ALL' sources who are ticked in the column 'Drag Source Types '. In your case, Image 9 can accept sources of type "Bad conscience".

    Since you have unchecked the option accept everything, and the value of Count is 1 (which is default). Here so the target can accept only 1 source of type "Healthy Conscience of the United Nations" and lift reject legend of error on the acceptance of another source.

    Check the option "accept all the ' try and let me know if this works for you.

    If this does not solve your problem please share your Cptx file to address the issue by e-mail ([email protected]).

    Thank you

    Derrick

  • Legend 1 success for multiple targets in a Drag and Drop Interaction

    I can't see how I can add legends of success to each target in an interaction drag-and - drop, but you can apply only 1 legend success multiple targets?

    1. The limits of smartshapes are overlapping with each other. For example, the smartshape on the 1st line was overlapped with the one on the 2nd line. For this reason, whenever you place the text of the 'Investment' legend on the smartshape on the 2nd line, it automatically moved to the smartshape on the 1st line. As a result, you could never get the right answer, and where you've ever seen the legend of success.

    Solution: Move the smartshapes another (or resize them) and make sure that there is no overlap.

    2, the number of attempts for this interaction has been on infinity. So, you have to play it until you get it right, but could not qualify because of the mention of the reasons above. That's why you have never seen the legend of failure.

    Solution: Disable the infinite in the accordion of Action and specify the required number of attempts. You will get the legend of failure if you don't get it right in these attempts.

    I just tested these solutions and it worked fine. Let me know if you still face problems.

  • Drag and drop Interaction - elements of drops

    Hello

    I use the new model of Interaction for drag and drops. It seems to work perfectly, but it is something I am struggling to do.

    Is there anyway you can restirct how many items can be placed on a drop zone? For the moment, you can drop more than one item from a drop zone and they overlap. My ideal solution would be so that you can only sheet one of the elements to an area or when you drop an item in a region that already has one there, it replaces it with a new one that just dropped.

    Thank you

    Yes, you can do what you ask. Here are some tutorials of Pooja, an expert! In the videos, she explains how to do exactly what you ask. https://www.adobeknowhow.com/courselanding/what-s-new-adobe-captivate-7.

  • Captivate 8 drag and drop interaction

    Hello

    just have a look at the new captivate 8 and when I try to do a drag - déposer question I go to normal place of window > drag and drop. but the problem is the drag and drop option is grayed out - would it because I have only this class on a copy of the trial?

    Nope.  This is because cannot not have slip and fall in a sensitive to the Cp8 project.

    Try to create a normal inadmissible project and you should find that drag-and - déposer is not disabled.

  • Blank screen after an interaction drag-and - drop

    Hey, I'm back.

    I have a small question about a drag and drop interaction in Captivate 8. Right now, it's together to continue to the next slide after three failures (with a failure caption) or to display a success message about success, then move to the next slide. However, when I publish it, it goes to a white screen for a few seconds after I finish the drag and drop interaction and moves to the next slide. The rest of the slides have text entry areas, and none of them have the blank screen between them.

    No one knows what might happen? I feel like there is a setting I'm missing or something. I've attached screenshots of the slide settings and drag and drop settings. Please let me know if you need more information.

    dd settings.PNGslide settings.PNG

    Why have you changed the suspension point to such a very short 0.1 seconds, what is the idea behind this? Yesterday, I already warned another user that such short duration is not at all recommended. D & D slides have a lot of code built in, and you add an action on enter to hide the playback bar. How long lasts this slide altogether? The point of suspension is not visible on the timeline, but your change will cause this situation:

    • an active slide part is 0.1sec
    • the inactive part of the slide is the slide duration less 0.1 sec; If you have kept the slide to 3 seconds duration, which means, 2.9 seconds
    • When you click on the submit button and exhaustion of attempts are executed measures OnSuccess or OnFailure: both go out of reading in your case, and the playhead must continue on the timeline for 2.9secs
    • If your items are not timed for the rest of the slide but end before this end, at some point you will indeed see a slide "blank."
  • Interaction drag-and - drop - time after the presentation of the self.

    Captivate 8.0.1.242 - Windows 7 - 64 bit - SWF - sensitive Format format not


    I drag and drop interactions in my class. I allowed for the correct drag auto shipping option and file the response. But when I publish the course and run the course online, there is a delay after drag / drop the right answer. There is no sign of loading or whatever it is. Just a delay, then I see the next slide. Its strange to students they start clicking on random areas, thinking that they have made a mistake.


    I would like to know as to why there is this delay and how to remove it.



    Hello

    I think the problem is with Actions that are currently assigned to the interaction. If you look closely, you will probably find that the slide is a break to 1.5 seconds. And the action assigned to the right answer is probably "continue." This means that play resumes and it takes another 1.5 seconds to visit the next slide.

    Try changing the action "Go to the next slide" and the delay must be eliminated.

    See you soon... Rick

  • On the legend of rejection only appear not in the interaction drag and drop

    Hello

    I'm playing with drag and drop interaction to understand its functionality.

    I noticed that we can accept, reject and hint captions to individual moving targets. When I tested it, I Accept and indication of the legends as expected. But I don't get the legend to reject even when I place the wrong source on the target.

    What I am doing wrong?

    Anthony

    Hello

    Dismiss the legend appears when an unacceptable source fell on a target. To configure the "acceptance criteria", select a drop target, click on 'Accept' button, deselect the checkbox corresponding to the unacceptable source. (As shown below)

    Now each time the drop source user 'Unaccept' on top of the target, the legend of "Reject" will appear.

    Thank you

    VERALINE Sukumaran.

  • interaction reset drag-and - drop

    Hello
    How reset a conducted drag and drop interaction, so I can redo the interaction drag-and - drop?
    If I try and return objects to their original location he just snaps back to the filled location
    Currently I have to move to another page, and then return to the page containing drag drop interaction in order to reset the interaction
    Thanks in advance
    Jon

    Amy was soon
    Works a treat
    Jon

  • Captivate 9 Drag and Drop DropIncorrect State does not

    Hello!

    I ve done a Drag and Drop interaction, where I have 4 targets and 4 drag only one correct answer for each of the sources. I've added States for Drop targets:

    DropCorrect State, The target turns Green when pressing submit, and the answer is correct.

    DropIncorrect State, target Drop becomes Red when press submit and answer is incorrect.

    I thought that it would be a good way to show the user which targets Drop are correct and which aims to drop they must change to get the right answer.

    When the answer is correct, Drop targets turns green and I made an action that says "OK, click anywhere to continue."

    BUT when the answer is wrong, nothing happens to the colors of the Drop target. It s just a failed, Try Again message. Nothing more.

    Why isn´t the State DropIncorrect showing when I press the submit button and the answer is incorrect?

    I just checked the file of this article, which was created on an earlier version of 9 and it works well also for the State of DropInCorrect, but I have only 1 attempt! I suspect that your endless attempts are the cause of the DropIncorrect does not. Compare it with actions on a question slide: success action will be performed when the answer is correct, but the other action will be done only at the last attempt is finished and the answer is wrong. Since you have endless attempts, this last attempt event never occurs.

    Sorry for the late reply, wanted to check a second time and has been very busy today.

Maybe you are looking for

  • First HP: Complete the square

    Is it possible to fill the spot on the first HP?  The TI-Nspire to do this with ease. Ex.(s^2+2S+5) = (s + 1) ^ 2 + 4

  • SATA on Tecra S11 speed

    Hello I'm looking for a tecra S11 sata connection speed.I want to replace my ssd for the greater and I was wondering if I could win something when I buy a sata-600 drive instead of the sata-300 that I use at the moment.I use an OCZ vertex II now (120

  • Toshiba NB200-10z - creator.lnk recovery disk is not available

    Hello, I have a problem with my Toshiba NB200-10z netbook, when I run creator of recovery disk Toshiba with that I get the window: The unit or the network connection to which the link refers to "creator.lnk recovery disk is not available.Make sure th

  • Satellite C50 - B - 14 d - two finger scroll does not work

    I've had my laptop for about 6 months now and I am generally happy with it. However, the two fingers scrolling has stopped working (it was working fine when I got it and for some time after). I know that it is not essential, but it made such a differ

  • RMS measurement over time "long".

    Hello I want to measure the RMS of 'complex' waveforme, so it is quite difficult to calculate from the graph. I use a power - gauge. My proplem is that the result is digitally displayed and the result changes from time to time. the signal is periodic