Well, this is basically a drag and drop routine if you need to check something while dragging.
To break it down:
code:
on(press){
startDrag(this);
//This creates a function watch for onMouseMove events. That means whenever the
//mouse is moved, whatever is inside of this function will occur.
this.onMouseMove = function(){
//For now, it is your hittest, however, you add as much code as you like in this statement.
if(_root.pin.hitTest(_root.balloon)){
_root.balloon.balloon2.gotoAndPlay("popped");
}
}
}
on(release){
stopDrag();
//Setting this.onMouseMove to undefined is erasing whatever checks were set up in
//onPress statement.
this.onMouseMove = undefined
}
I've used something like this for mouse based games before.




Reply With Quote