Step 1 : The circle, square are draw, these are the object will be drag. The rectangle will be the location for the object.
Step 2 : Convert the circle, square and two rectangle to symbol> movie.
Name the rectangle as box1 and box 2 at the properties when we click on it.
Step 3: The red circle is the object we need to drag, right click and write the action script.The original position of the red circle can be refer to the X and Y in properties.
on (press) {
startDrag(this);
}
on (release) {
stopDrag();
if ((this._x>=301.4) & (this._x<=406.3) & (this._y>=84.0)& (this._y<=105.4)) / Value X and Y determine from Step 6
{
_root.box1.gotoAndStop(2);
}else {
_root.box1.gotoAndStop(1);
this._x = 74.0; / original position
this._y = 84.0; / original position
}
}
Step 4: Double click on the rectangle box, we able to see the first frame like this and we add the action script stop ( ); on the first frame.
Step 5 : Go to the second frame we add the red tick and action script stop on it.
Step 6: Determine the location for correct area by bring the red circle to the rectangle, we able to know X and Y through the properties. Change the value X and Y on the action script according to the value in properties.
No comments:
Post a Comment