PDA

View Full Version : two buttons in two mc's



Seticus
October 11th, 2003, 08:07 AM
Strange, but I have never before noticed this problem, maybe you guys can help me:

I've got two movieclips, containing each two buttons. I was thinking about giving the buttons the following AS:


on (keyPress "+") {
if (pushed == true) {
startDrag("_root.mc2");
pushed = false;
} else if (pushed == false) {
stopDrag();
pushed = true;
}
}


for the button in "mc2" and


on (keyPress "+") {
if (pushed == true) {
startDrag("_root.mc1");
pushed = false;
} else if (pushed == false) {
stopDrag();
pushed = true;
}
}

for the button in "mc1".

In the first frame in the root:


mc1.pushed = true;
mc2.pushed = true;


This won't work, because flash doesn't know which mc he has to move when "+" is pressed, but I still want this to work. Any ideas? It's weird, when you want to drag one, you always start dragging the lower one...

kode
October 11th, 2003, 08:35 AM
You can't drag 2+ instances at the same time with startDrag.
See http://proto.layer51.com/d.aspx?f=845. ;)

Voetsjoeba
October 11th, 2003, 08:37 AM
You mean like this ?

Seticus
October 11th, 2003, 08:44 AM
mm, something like that, but now you can start dragging the other mc when you're not even on it. It should be something like this, use the "-" and the "+" keys to drag them and release them. I want to use the "+" key for both of them...

I thought it was possible, maybe by using Key.getAscii(); ?

Seticus
October 11th, 2003, 08:46 AM
sorry forgot to add the attachement

Voetsjoeba
October 11th, 2003, 08:47 AM
Location: Belgium -- Location: Belgium, Ghent ;)

So let me get this straight: when you press +, you want to start dragging one. When you press + again, you want them both to be dragged. And when you press -, you want the last one that was dragged to stop being dragged. And if you press - again, none will be dragged anymore. Correct ?

Voetsjoeba
October 11th, 2003, 09:20 AM
Like this then ?

Seticus
October 11th, 2003, 11:16 AM
I'm from Veurne (weet je wel liggen denk ik)

it's a cool effect, but that's not it. I found it: check attachement

This is what I wanted, when you move your mouse over one mc, and press + you start dragging that one. When you press + again, you drop it. This for both mc's, it caused some trouble, the solution was working with Key.getAscii();

Thanks a lot, hope to see you around :)

Voetsjoeba
October 11th, 2003, 11:33 AM
Aah, I see ... then why were you talking about the "-" ? :P Glad you got it working :)

Seticus
October 11th, 2003, 11:44 AM
if I used "+" to drag both mc's it didn't work, so I changed one to "-" and gave it to you... :p

Voetsjoeba
October 11th, 2003, 12:09 PM
Lol :P

Anyways, you got it working the way you wanted it to, that's what matters :)