Tuesday, November 4, 2008

hittest scripts

In this example, drag the girl over the seashell.

// girl instance script
onClipEvent(mouseDown){
startDrag(this);
}
onClipEvent(mouseUp){
stopDrag();
}


// FRAME 1 script
// girl movie clip instance
girl.onPress = function() {
this.startDrag();
};

// girl movie clip instance
girl.onRelease = function() {
this.stopDrag();
// seashell_01 instance
if (this.hitTest(seashell1)) {
_global.totalpickedup = 1;
_root.seashell1._visible = 0;
trace("you picked up a SeaShell");
}
// seashell_02 instance
if (this.hitTest(seashell2)) {
_global.totalpickedup = 1;
_root.seashell2._visible = 0;
trace("you picked up a SeaShell");
}
};

No comments: