문제

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.

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top