현재 프로젝트를 수행하는 동안 hitTestPoint 정확도는 객체를 이동하자마자 한 프레임 지연됩니다. 따라서 객체 A가 완전히 새롭고 먼 위치로 이동되면 해당 객체에서 수행 된 hitTestPoint는 false를 반환합니다. 이를 설명하기 위해, 내가 가장 기본적인 논리를 사용하여 빠른 실험을했습니다 : 나는하여 hitTestPoint 제거하고 아이를 추가 한 후 다시 작동하는 것을 발견AS3 hitTestPoint 정확도가 한 프레임 씩 지연됩니다.
Hit test at (0,0) while object is at (0,0) = true
>>>>>>>>>> WHERE DID THE OBJECT GO? >>>>>>>>>>
Hit test at (0,0) while object is at (300,300) = false
Hit test at (150,150) while object is at (300,300) = false
Hit test at (300,300) while object is at (300,300) = false
>>>>>>>>>> WHERE DID THE OBJECT GO? >>>>>>>>>>
After remove/addChild, hit test at (300,300) while object is at (300,300) = true
: 여기
import flash.display.Sprite;
import flash.display.Graphics;
import flash.events.Event;
var me:Sprite = new Sprite();
var g:Graphics = me.graphics;
g.beginFill(0xFF0000);
g.drawRect(-10, -10, 20, 20);
g.endFill();
addChild(me);
trace("Hit test at (0,0) while object is at (" + me.x + "," + me.y + ") = " + me.hitTestPoint(0, 0, true));
me.x = 300;
me.y = 300;
trace("\n>>>>>>>>>> WHERE DID THE OBJECT GO? >>>>>>>>>>");
trace("Hit test at (0,0) while object is at (" + me.x + "," + me.y + ") = " + me.hitTestPoint(0, 0, true));
trace("Hit test at (150,150) while object is at (" + me.x + "," + me.y + ") = " + me.hitTestPoint(150, 150, true));
trace("Hit test at (300,300) while object is at (" + me.x + "," + me.y + ") = " + me.hitTestPoint(300, 300, true));
trace(">>>>>>>>>> WHERE DID THE OBJECT GO? >>>>>>>>>>\n");
removeChild(me);
addChild(me);
trace("After remove/addChild, hit test at (300,300) while object is at (" + me.x + "," + me.y + ") = " + me.hitTestPoint(300, 300, true));
및 결과입니다 다시 무대로. 그러나 hitTestPoint도 다음 프레임에서 작동합니다.
누구나 지금까지 이와 동일한 문제가 발생 했습니까?