Copy link to clipboard
Copied
I have a movie clip that also has the function to duplicate. What I want is that if the user dosent want so many duplicates, to have an area where if he drags the duplicates, they will disappear. Thank you.
The if() condition is checking...
if(_x > low limit and < high limit AND _y > low limit and < high limit)... remove the movieclip
Copy link to clipboard
Copied
This is probably what you are looking for:
Copy link to clipboard
Copied
Thank you but that is for as3, and I need for as 2 🙂
Copy link to clipboard
Copied
Oh whoops - my apologies!!! I keep forgetting to check what section I am in because I view questions from the main Flash page, haha
Copy link to clipboard
Copied
no problem 🙂
Copy link to clipboard
Copied
You use the removeMovieClip() function to remove a movieclip that is added using the duplicateMovieClip() function. If you want to have it happen when you drag and drop a movieclip to a particular area, then you need to have code in your drop function that checks if the object is in the desired area and then call the removeMovieClip function.
To check if the movieclip is in the desired area you could check if its _x/_y properties are within some range of values, or you could use a dropTarget and see if the movieclip is dropped on it.
Your best bet will be to search Google for a drag and drop tutorial... try searching using terms like "AS2 drag and drop tutorial"
Copy link to clipboard
Copied
I've search on google but I did not found any tutorial for this particular thing. I found instead this code :
on (press) { startDrag ("", false);
this.swapDepths(_global.depth++);
}
on (release, releaseOutside)
{
stopDrag ();
this.swapDepths(_global.depth++);
if (this._x > 493.250000 && this._x < 636.050000 && this._y > 142.900000 && this._y < 271.350000)
{
this.removeMovieClip();
} // end if
}
but I don't know how to make the _x/_y to work, better said I changed the values but nothing happend, did I did something wrong ? The first _x/_y stands for the position? I've played with the range values but cant seem to make it happend.
Copy link to clipboard
Copied
The if() condition is checking...
if(_x > low limit and < high limit AND _y > low limit and < high limit)... remove the movieclip
Copy link to clipboard
Copied
Thank you so much, now I understand 🙂
Copy link to clipboard
Copied
You're welcome
Find more inspiration, events, and resources on the new Adobe Community
Explore Now