# Drag and drop with targets PROBLEM

**URL:** https://forum.kirupa.com/t/drag-and-drop-with-targets-problem/43059
**Category:** Uncategorized
**Created:** [February 18, 2004, 12:39pm UTC](https://forum.kirupa.com/t/drag-and-drop-with-targets-problem/43059 "2004-02-18T12:39:05Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![age6racer](https://avatars.discourse-cdn.com/v4/letter/a/dfb087/32.png) [@age6racer](https://forum.kirupa.com/u/age6racer)
#### Post date: [February 18, 2004, 12:39pm UTC](https://forum.kirupa.com/t/drag-and-drop-with-targets-problem/43059/1 "2004-02-18T12:39:05Z")

</div>

I know there are posts on the forums about drag and drop with targets but none of them help me.

I have gone through the tutorials on drag and drop and have successfully made a number of drag and drop flash animations.

HOWEVER…

I can’t get this \*\*\*\* target thing to work and I’m following the tutorial as closely as I can.

Wouls someone please take a look at my FLA / code and try and give me some pointers. I’m getting really fed up of testing the same scene over and over and over and i want to get on with the next one!

thanks!

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [February 18, 2004, 1:21pm UTC](https://forum.kirupa.com/t/drag-and-drop-with-targets-problem/43059/2 "2004-02-18T13:21:43Z")

</div>

I could, if you’d upload the .fla 😉

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [February 18, 2004, 1:25pm UTC](https://forum.kirupa.com/t/drag-and-drop-with-targets-problem/43059/3 "2004-02-18T13:25:48Z")

</div>

I can give you an url to the FLA becuase it’s too big to post. Do you have a decent internet connection? It’s about 6mb i think.

[it’s here](http://www.bi03.co.uk/hopesfall/loadscene&dragtarget.fla)

cheers!

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [February 18, 2004, 1:47pm UTC](https://forum.kirupa.com/t/drag-and-drop-with-targets-problem/43059/4 "2004-02-18T13:47:15Z")

</div>

I’ll get right on to it!

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [February 18, 2004, 1:55pm UTC](https://forum.kirupa.com/t/drag-and-drop-with-targets-problem/43059/5 "2004-02-18T13:55:46Z")

</div>

Ok thanks.

well this is what I want to do.

When you get it opened you should see a man floating in space. (i suggest you test the scene to see what’s happening) I want that man to be dropped onto the white and blue flashing circle on the right. and when this happens i want the movie to jump to a different frame.

You will see that I have the code for the drag and drop on the MC of the man. and I have the if function on the frame in the timeline. (it doesnt work on the MC either)

I hope you can work it out. I’m sure you can, I’m just new to this stuff thats all.

thanks again.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [February 18, 2004, 1:56pm UTC](https://forum.kirupa.com/t/drag-and-drop-with-targets-problem/43059/6 "2004-02-18T13:56:56Z")

</div>

sorry… I don’t get it to work either…

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [February 18, 2004, 1:59pm UTC](https://forum.kirupa.com/t/drag-and-drop-with-targets-problem/43059/7 "2004-02-18T13:59:53Z")

</div>

Ok well thanks for trying anyway Kall,

Does anyone else fancy having a go???

The file will be there at the link above so feel free to try and figure out what the hell is going on with it.

any help would be greatly appreciated!

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [February 18, 2004, 2:03pm UTC](https://forum.kirupa.com/t/drag-and-drop-with-targets-problem/43059/8 "2004-02-18T14:03:05Z")

</div>

Whats the code on the man MC?

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [February 18, 2004, 2:04pm UTC](https://forum.kirupa.com/t/drag-and-drop-with-targets-problem/43059/9 "2004-02-18T14:04:35Z")

</div>

on (press) {  
startDrag (this);  
}  
on (release) {  
stopDrag ();  
}

**and on the frame in the time line I have:**

if (dragman.\_droptarget == “/blueflash”)  
this.gotoandPlay(1);

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [February 18, 2004, 2:10pm UTC](https://forum.kirupa.com/t/drag-and-drop-with-targets-problem/43059/10 "2004-02-18T14:10:38Z")

</div>

1. it wont work because the condition will be only checked once, as the movie starts.  
Place the if statement inside the on(release)
2. you dont have an instance name for your man MC, how can you reference it?

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [February 18, 2004, 2:22pm UTC](https://forum.kirupa.com/t/drag-and-drop-with-targets-problem/43059/11 "2004-02-18T14:22:30Z")

</div>

Ok, I’ve changed the code and put it in the onRelease. it now looks like this:

on (press) {  
startDrag (this);  
}  
on (release) {  
stopDrag ();  
if (dragman.\_droptarget == “/blueflash”)  
this.gotoandPlay(1);  
}

is that alright?

And I’ve given the man and instance name ( i can’t believe I forgot that!) he’s now called “dragman” (like the MC is.)

BUT…

It’s still not working, any ideas why that might be?

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [February 18, 2004, 2:23pm UTC](https://forum.kirupa.com/t/drag-and-drop-with-targets-problem/43059/12 "2004-02-18T14:23:13Z")

</div>

What timeline should go to frame 1?

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [February 18, 2004, 2:24pm UTC](https://forum.kirupa.com/t/drag-and-drop-with-targets-problem/43059/13 "2004-02-18T14:24:32Z")

</div>

the main one.

Should it have a \_root or something along those lines? i was wondering about that.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [February 18, 2004, 2:26pm UTC](https://forum.kirupa.com/t/drag-and-drop-with-targets-problem/43059/14 "2004-02-18T14:26:17Z")

</div>

```auto
on (press) {
	startDrag(this);
}
on (release) {
	if (eval(this._droptarget) == _parent.blueflash) {
		_parent.gotoAndPlay(1);
	}
	stopDrag();
}

```

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [February 18, 2004, 2:32pm UTC](https://forum.kirupa.com/t/drag-and-drop-with-targets-problem/43059/15 "2004-02-18T14:32:22Z")

</div>

THANKYOU SO MUCH!!! i’m so very grateful!

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [February 18, 2004, 2:32pm UTC](https://forum.kirupa.com/t/drag-and-drop-with-targets-problem/43059/16 "2004-02-18T14:32:51Z")

</div>

welcome 🙂
