
June 26th, 2002, 09:06 PM
|
|
Junior Member
|
|
Join Date: Mar 2001
Location: Hamilton, Ontario
Posts: 3
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
You can get easy mouse over detection for any movie clip by creating a prototype function for the MovieClip class. I generally do the following:
1. Define the prototype in the first frame of the root level
Code:
MovieClip.prototype.mouseOver = function() {
if (this.hitTest (_root._x, _root._y) == true) {
return true;
} else {
return false;
}
}
2. Now every movie clip on the stage has the ability to call mouseOver() on itself, which will return either true or false.
For example, a movie could perform these actions:
Code:
onClipEvent (mouseMove) {
if (this.mouseOver() == true) {
...
}
}
Or to make a movie clip act like a button, you could do this:
Code:
onClipEvent (mouseDown) {
if (this.mouseOver() == true) {
...
}
}
Matt
|