PDA

View Full Version : drag, drop addition


Desual
04-14-2002, 02:20 AM
I'm trying to create a movie with 6 draggable MC's and 2 target areas. Each MC has a different numerical value.

I want the user to try out different combinations of MCs in the target areas and see the total of the two MC's within the target areas in a text box by pressing a calculate button.

I want to calculation to work even when only one target area is filled by a movie clip.

can anyone help?

thanks in advance. :D

(i have the dragging action working fine too, with the MC's snapping back to original area if the user misses the target area and snapping to the center of the target if the MC is placed inside the target area)

Desual
04-14-2002, 01:56 PM
this is some code for one or my MC's...the value being 1



on (press) {
startDrag(getProperty(_x, _y));
}
on (release) {
stopDrag();
if (_droptarget eq "/target_R1") {
setProperty("", _x, (_root.target_R1._x-15));
setProperty("", _y, _root.target_R1._y);
_root.R1 = 1;
} else if (_droptarget eq "/target_R2") {
setProperty("", _x, (_root.target_R2._x-15));
setProperty("", _y, _root.target_R2._y);
_root.R2 = 1;
} else {
setProperty("", _y, OrgY);
setProperty("", _x, OrgX);
}
}


this is the code for my calculate button...the value six is a constent in my addition as it a fixed part of the addition.

on (release) {
_root.tcr = 6+(_root.R1+_root.R2);

}


can anyone help???