PDA

View Full Version : Is there any way...



kitiara30
May 21st, 2002, 07:52 AM
I can get a dragged object to snap to the centre (or specified position) of it's target without a lot of fiddling around with _x and _y? I've got 9 of these objects, and I can't bear the thought of having to working out the multitude of co-ords...

Iammontoya
May 21st, 2002, 10:47 AM
well.. I dont know about fiddling a whole LOT... but I dont know of any other way to do it..

hit=mcdrag.hittest(mctarget);

if(hit==true){

mcdrag._x=mctarget._x;
mcdrag._y=mctarget._y;

}

copy/paste/edit.. fun fun fun...

perhaps someone else will come up with easier way.

Good luck!

ilyaslamasse
May 21st, 2002, 02:40 PM
You can also use _dropTarget (tutorial on this site).

pom 0]

SuperDaiv
May 23rd, 2002, 03:54 PM
I'm not absolutely positive that this would work in ActionScript, but if would in C, the language ActionScript is based on.. you should be able to shorten the code to the following:


if( mcdrag.hittest(mctarget) ){
mcdrag._x=mctarget._x;
mcdrag._y=mctarget._y;
}


I don't know, might make it a little easier..

ilyaslamasse
May 24th, 2002, 01:11 AM
That will work. Simpler, cleaner, faster.

pom 0]

_dropTarget though my advice is.