[COLOR=#000000][FONT=Arial]I have this AS3 code:[/FONT][/COLOR]
circle_mc.addEventListener([COLOR=#2B91AF]MouseEvent[/COLOR].MOUSE_DOWN, drag);
square_mc.addEventListener([COLOR=#2B91AF]MouseEvent[/COLOR].MOUSE_DOWN, drag);
stage.addEventListener([COLOR=#2B91AF]MouseEvent[/COLOR].MOUSE_UP, drop);
[COLOR=#00008B]function[/COLOR] drag(e:[COLOR=#2B91AF]MouseEvent[/COLOR]):[COLOR=#00008B]void[/COLOR]
{
e.target.startDrag([COLOR=#00008B]false[/COLOR], [COLOR=#00008B]new[/COLOR] [COLOR=#2B91AF]Rectangle[/COLOR]([COLOR=#800000]30[/COLOR],[COLOR=#800000]30[/COLOR],[COLOR=#800000]150[/COLOR],[COLOR=#800000]150[/COLOR]));
}
[COLOR=#00008B]function[/COLOR] drop(e:[COLOR=#2B91AF]MouseEvent[/COLOR]):[COLOR=#00008B]void[/COLOR]
{
stopDrag();
}
[COLOR=#000000][FONT=Arial]Now, if I test the movie, if I click the circle or the square, they will jump in the stage, because I’m not allowed to move them out of that rectangle.[/FONT][/COLOR]
[LIST=1]
[]I want the script to allow me to drag the shapes anywhere (while the MOUSE_DOWN event is active), but still not allow me to drop them out of it (on MOUSE_UP).
[]How can I use an object instead of that rectangle stage?
[/LIST]