Director Example (5 lines)
--first click the "movable icon" under the mover
sprite's properties then attach the following
property spritenum
on mouseup
if sprite(spritenum).intersects sprite1 then sprite(spritenum).blend=20
end
--unfortunately spritenum needed to be declared as
a property for this example
Flash
Translation (12 lines)
//first make the
sprite movable on mousedown. sprite must be set to be a movieclip
on (release){
onClipEvent (mouseDown) {
if (this.hitTest(_root._xmouse, _root._ymouse)) {
this.startDrag();
}
}
//then make the sprite not movable on mouseup
onClipEvent (mouseUp) {
if (this.hitTest(_root._xmouse, _root._ymouse)) {
this.stopDrag();
//now perform the intersect test. The target's
instance name needs to be "1" also
if (this.hitTest(_parent.1)) {
this._alpha = 20;
}
}
}
|