Question

My circle_mc is draggable. Then when it hit another movieclip on stage, is there any way to show up the instance name hit by the circle_mc?

is it possible this way...

var theInstanceName:String = circle_mc.hitTestObject()

Any solution for this. Thanks in advance.

Was it helpful?

Solution

You should perform a hit test against the various objects, for example, assuming you had an array objects of movieclips and wanted to return another array collidingMovieclips:

var collidingObjects:Array = new Array();
for(var i:int = 0; i < objects.length; i++) {
    if(circle_mc.hitTestObject(objects[i])) {
        collidingObjects.push(objects[i]);
    }
}

You could quite easily add objects[i].name to return the instance names instead, but I'm not sure why you'd want to.

Note that this is by no means the most efficient method, but may be sufficient to meet your needs.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top