# Drag and goto sene 2

**URL:** https://forum.kirupa.com/t/drag-and-goto-sene-2/21377
**Category:** Uncategorized
**Created:** [May 21, 2003, 3:03am UTC](https://forum.kirupa.com/t/drag-and-goto-sene-2/21377 "2003-05-21T03:03:30Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![cardjorg](https://avatars.discourse-cdn.com/v4/letter/c/a183cd/32.png) [@cardjorg](https://forum.kirupa.com/u/cardjorg)
#### Post date: [May 21, 2003, 3:03am UTC](https://forum.kirupa.com/t/drag-and-goto-sene-2/21377/1 "2003-05-21T03:03:30Z")

</div>

can anyone help please?

I want to drag a button to a rectangle and when i drop it, it’ll go to sene 2 i attached this fla so you get an idea of what i want ant tell me what did I do wrong.  
thankyou

---

<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: [May 21, 2003, 3:51am UTC](https://forum.kirupa.com/t/drag-and-goto-sene-2/21377/2 "2003-05-21T03:51:27Z")

</div>

hmm  
I dont understand the problem fully. I had to do a few things to make it work.

1. Buttons do not have a \_droptarget property.  
Change circle\_mc to a movieclip and put your code into frame 1 of the clip in this form…

function onPress() {  
this.startDrag(false);  
}  
function onRelease() {  
this.stopDrag();  
if (this.\_droptarget==“whatever”)  
doWhatever();  
}

1. If you trace(this.\_droptarget) you will find that it is not “\rec\_mc” but instead…"\rec\_mc\rec\_mc" . Very strange. I don’t know why flash does this, but I fixed it by using rec\_mc as a movie clip instead of a graphic (which was what you had it as). Then trace(this.\_droptarget) outputs “\rec\_mc”.

2. I couldn’t get the code gotoAndPlay(“Scene 2”, 1) to work from anywhere except the main timeline. So… put it in a function like this on frame one.

function doWhatever()  
{  
gotoAndPlay(“Scene 2”, 1);  
}

These are out-of-the-ordinary problems, and I would blame flash not you. The \_droptarget property is from Flash 4, and its kind of a pain to use slash notation in MX. As for the scene change problem, thats just inexcusable. You would think a movieclip could tell the maintimeline to switch scenes. Oh well.

---

<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: [May 21, 2003, 10:52am UTC](https://forum.kirupa.com/t/drag-and-goto-sene-2/21377/3 "2003-05-21T10:52:09Z")

</div>

I’ve responded a few times to this througout the night. Most of the time I was at work. I know that you can use hitTest to do what you want to acomplish. The hitTest tut here is from Flash 5 and I knew that it had changed. Everything that I thought would work, didn’t. If anyone could tell me why I couldn’t use this line of code, please tell me, it’s killin’ me!!  
[AS]  
onClipEvent(enterFrame){  
if(this.hitTest(\_root.brown)){  
\_root.textbar=“hit”}  
else{  
\_root.textbar=""}  
}  
[/AS]

I saw some tuts that said to do it just like that, but I must be missing something (probably with levels). The attached has a working hitTest on it in dot syntax, but it puts the draggable movieClip in a different level. Boo!!  
Here’s the tut that showed me the way. I didn’t go much further because it’s 3:52am, tired…  
[http://www.informit.com/isapi/product\_id~{7171FE6E-FE0D-4706-B08C-C2BBF1EE3227}/element\_id~{FB477920-5822-44D1-AC6F-98FF608EAC8B}/st~{2468EBAC-018A-401F-A52B-D23A1FD08348}/content/articlex.asp](http://www.informit.com/isapi/product_id~%7B7171FE6E-FE0D-4706-B08C-C2BBF1EE3227%7D/element_id~%7BFB477920-5822-44D1-AC6F-98FF608EAC8B%7D/st~%7B2468EBAC-018A-401F-A52B-D23A1FD08348%7D/content/articlex.asp)

whew…I’ll still work on it because it’s bugging the crap out of me.

😠

---

<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: [May 21, 2003, 1:54pm UTC](https://forum.kirupa.com/t/drag-and-goto-sene-2/21377/4 "2003-05-21T13:54:57Z")

</div>

works on my computer

---

<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: [May 21, 2003, 3:48pm UTC](https://forum.kirupa.com/t/drag-and-goto-sene-2/21377/5 "2003-05-21T15:48:49Z")

</div>

I’m just and amature using flash and action script , but one more question do action script comands work different Flash versions? and thanks for answering my question .  
I appresiated

---

<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: [May 21, 2003, 3:55pm UTC](https://forum.kirupa.com/t/drag-and-goto-sene-2/21377/6 "2003-05-21T15:55:11Z")

</div>

earlier flash versions wont have some commands, and the notation is different (dots or slashes)

other than that i dont think command should behave any differently in different versions.

---

<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: [May 22, 2003, 12:21am UTC](https://forum.kirupa.com/t/drag-and-goto-sene-2/21377/7 "2003-05-22T00:21:00Z")

</div>

clownstaples:  
Yeah, the .fla works. The only thing I don’t like is the layers/levels, but I know I can fix that. Can you see what’s wrong with the code that I typed out above? Cause that doesn’t work and it’s bummin’ me out…  
😠

---

<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: [May 22, 2003, 4:02am UTC](https://forum.kirupa.com/t/drag-and-goto-sene-2/21377/8 "2003-05-22T04:02:35Z")

</div>

clownstaples,

if there is not much problem could you attach the fixed fla so I can see what i did wrong pleasssse?  
because I couldn’t made it work.  
thanks:rambo:

---

<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: [May 29, 2003, 2:47am UTC](https://forum.kirupa.com/t/drag-and-goto-sene-2/21377/9 "2003-05-29T02:47:23Z")

</div>

no prob
