chronicsmoke
11-02-2002, 03:11 PM
Hi,
okay...the problem: write an Actionscript that tells a movie to jump to frame 3 if two (or more) movieclips are dragged AND RELEASED over a certain target area.
I got two MC in my movie with the following Actionscript on each of them (except different instance names off course):
on (press) {
startDrag(getProperty(_x, _y));
}
on (release) {
stopDrag();
if (_droptarget == "/hitarea01") {
nextFrame();
} else {
setProperty("", _y, OrgY);
setProperty("", _x, OrgX);
}
}
In the "actions"-layer of the main timeline, I've got a nested if-statement that checks if both MC are dragged over the hitareas. I used this code:
if (circle01.hitTest(hitarea01)) {
if (circle02.hitTest(hitarea02)) {
gotoAndPlay(3);
}
}
On frame 3, I've put a message that both MCs were dragged over the correct target areas.
It works. Anyway, I don't want the movie to jump if both MCs are dragged but if the user releases the mouse button. I've tried to use the _droptarget-property but it just doesn't work well...
In order to get a clue of what I've meant, I attached my *.fla to this post.
Any tips would be helpful.
Thanx.
okay...the problem: write an Actionscript that tells a movie to jump to frame 3 if two (or more) movieclips are dragged AND RELEASED over a certain target area.
I got two MC in my movie with the following Actionscript on each of them (except different instance names off course):
on (press) {
startDrag(getProperty(_x, _y));
}
on (release) {
stopDrag();
if (_droptarget == "/hitarea01") {
nextFrame();
} else {
setProperty("", _y, OrgY);
setProperty("", _x, OrgX);
}
}
In the "actions"-layer of the main timeline, I've got a nested if-statement that checks if both MC are dragged over the hitareas. I used this code:
if (circle01.hitTest(hitarea01)) {
if (circle02.hitTest(hitarea02)) {
gotoAndPlay(3);
}
}
On frame 3, I've put a message that both MCs were dragged over the correct target areas.
It works. Anyway, I don't want the movie to jump if both MCs are dragged but if the user releases the mouse button. I've tried to use the _droptarget-property but it just doesn't work well...
In order to get a clue of what I've meant, I attached my *.fla to this post.
Any tips would be helpful.
Thanx.