|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi,
Recently upgraded to MX, only to find to my horror that the flash5 version of doing 'onMouseover tell target' doesn't appear to be obvious in the new MX actionscript. Anybody know how I can set a movieclip to tell target via a rollover using the new actionscript? Cheers, Ryan |
|
#2
|
|||
|
|||
|
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 |
|
#3
|
|||
|
|||
|
Use these:
Code:
mc1.onRollOver = function() {
trace(this._name);
}
mc2.onRollOver = function() {
trace(this._name);
}
The mouseOver event(s) are listener-based. That's why they weren't working the way you expected them to. You can look up listeners in the reference panel for more information. Hope that helps... |
![]() |
| Viewing: Dev Shed Forums > Web Design > Flash Help > Flash MX - Mouse Event |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|