PDA

View Full Version : Drag and Drop Extension...


Kizzi
07-04-2008, 07:31 PM
Right, I know how to do the drag and drop (that's the only thing in my code ATM). I've drawn a draggable circle, some text and a box. I want the text to change when I drag the circle into the box. Help plz? :confused:
||||Kind Regards,
~Kizzi
Edit: Oh yeah, and it's Actionscript 2 with Flash MX Professional.

Pedal-kid
07-05-2008, 12:13 AM
create a dynamic text, give it a instancename "txt" and a var "textvar".
the circle's instancename is supposed to be "circle"
add this to the frame:
onEnterFrame=function() {
if (circle.hitTest(txt)==true) {
textvar="whatever"//or whatever you wont

} else {
textvar="something"//or what ever you wont


}
}
you said you had done the drag and drop part, so you don't need anymore than this i guess

Kizzi
07-06-2008, 08:27 PM
I've edited it a bit, and I think the core of it works. However, the text won't change (because of the onEnterFrame command probably). How should I fix this?

neilmmm
07-06-2008, 08:54 PM
circle_mc.onPress = function() {
this.startDrag();
this.onEnterFrame = function() {
if (this.hitTest(box_mc)) {
my_txt.text = "hit";
} else {
my_txt.text = "";
}
};
};
circle_mc.onRelease = circle_mc.onReleaseOutside=function () {
this.stopDrag();
delete this.onEnterFrame;
};