I'm having some problems with a hitTest in a project, so I've been experimenting and I've come up with some really strange results. I'm trying to use hitTest after changing the frame of a movieclip, but for some reason it doesn't work. I assumed it was because the graphics didn't update until the next frame, but when I was experimenting I found that it sometimes works and sometimes doesn't.
Here's the example I made. Here's the code that runs it:
block.gotoAndStop(2);
btn1.onRelease = function() {
block.gotoAndStop(1);
txt.htmlText = "_xmouse,_ymouse: " + block.hitTest(_xmouse,_ymouse,true) + "<br />btn1: " + block.hitTest(this);
};
btn2.onRelease = function() {
block.gotoAndStop(2);
txt.htmlText = "_xmouse,_ymouse: " + block.hitTest(_xmouse,_ymouse,true) + "<br />btn2: " + block.hitTest(this);
};
btn3.onRelease = function() {
block.gotoAndStop(3);
txt.htmlText = "_xmouse,_ymouse: " + block.hitTest(_xmouse,_ymouse,true) + "<br />btn3: " + block.hitTest(this);
};
Click a white box to move the red box (via gotoAndStop) and the text will display first a shapeflag hitTest using _xmouse and _ymouse, then on the second line a hitTest with the white box you clicked.
What I've come up with so far is the hitTest on the box itself always works, the shapeflag hitTest on the far left box always works (it's the red box's frame 1... maybe that changes things?) the shapeflag hitTest on the middle one sometimes works (only after clicking the far right box then the middle box?) and the final shapeflag hitTest doesn't work.
All three hitTests work if you click the place that the red box is already over.