Hi. Can anyone help me with the following code. I want to create a small quiz whereby the user drags images (different types of film shots) under their appropriate headings. I want the following ‘feedback’ for the user:
-
If the image is dragged under the correct heading (ie. in the correct target area), then the image will stay there and change its alpha settings to 50%.
-
If the image is dragged under the incorrect heading, then on release the image is returned to its starting position.
What works: dragging and return to original starting position
What doesn’t work: image staying in the correct target area, change in alpha settings once image is in (theoretically!) the correct target area.
Here is my code - am I missing a crucial line of the code? Any help would be greatly appreciated. Thanks.
on(press) {
startDrag(this, false);
swapDepths(100);
}
on(release) {
stopDrag();
//if the dragged object is on the
//‘ms_target_mc’ area
//leave the dragged object in this area
//and change its alpha settings to 50%
if (this._droptarget == “/ms_target_mc”) {
//x and y values of the target area
setProperty(this, _x, 482.0);
setProperty(this, _y, 227.8);
setProperty(this, _alpha, 50);
//if the dragged object is not on the
//desired target area
//return the object to its starting position
} else {
setProperty(this, _x, 195.5);
setProperty(this, _y, 288.5);
}
}
PS: I’m using Flash MX 2004, Education edition