-
[MX] Drag And Drop!!!
Just a very basic question, shouldn't be too hard to answer, but I couldn't find it anywhere else. (Couldn't think of any keywords)
I have a basic game board, with nine gray circles in it. there are also nine chocolates, and They can be dragged anywhere on the screen. But I need a script so that when a user drops the piece, it slides to the center of the intended spot.
Ex:
on(release) {
stopdrag(this)
this.:confused: hit test of circle?
if yes, this._x and this._y = circle1._x and circle1._y:confused:
I don't know, something like that. do I need an array? as the smiley says,
:confused: CONFUSED:confused:
-
Try this:
PHP Code:
on(release) {
stopDrag(this);
if (_root.circle.hitTest(this._x, this._y, true))
{
this._x = _root.circle._x;
this._y = _root.circle._y;
}
}
-
The code seems like it would work, but for some reason, it doesn't see the circle. I exported for as with linkage, but it still dosent work.
RRRGGGH!!
-
Did you set its instance name to "circle"? You only need to export a movie clip to AS if you plan to create it dynamically in the code.