Hi kglad,
The code I uploaded has some error, here is my new code about highlight:
root.stageMouseMoveHandler = function(e)
{
if (pieces.target)
{
pieces.target.x = (e.stageX / stage.scaleX) - pieces.target.offsetX;
pieces.target.y = (e.stageY / stage.scaleY) - pieces.target.offsetY;
var test = slots.getObjectUnderPoint(pieces.target.x, pieces.target.y);
root.targetHighlightOn();
}
};
root.targetHighlightOn = function()
{
var highlight = slots.getObjectUnderPoint(pieces.target.x, pieces.target.y);
if (!highlight){
/* slots.children.forEach(function(child, index){
child.gotoAndStop(0);
});*/
return;
}
root.highlightOn = highlight.parent.parent;
root.highlightOn.gotoAndPlay(1);
}
Now it can highlight the area by playing the highlight movieclip. But I don't know how to stop the movieclip when dragging objects out of the area.
try:
root.targetHighlightOn = function()
{
var highlight = slots.getObjectUnderPoint(pieces.target.x, pieces.target.y);
if (!highlight){
if(root.highlightOn){
root.highlightOn.gotoAndStop(0);
root.highlightOn = nul;
}
} else {
root.highlightOn = highlight.parent.parent;
root.highlightOn.gotoAndPlay(1);
}
}