Skip to main content
Inspiring
October 3, 2006
Question

glitch in rollover event

  • October 3, 2006
  • 3 replies
  • 191 views
hi i'm new to flash, but not new to coding... i just picked up flash, and just learned what actionscripting was a couple weeks ago and i'm hooked! anyways, i am having a problem with an onRollOver even in my swf file.... where to begin? ok, if you take a look at my swf file here
you will notice that if you roll the mouse over the computer monitor, the monitor will grow.... and if you roll out, the monitor will shrink.... here's the problem: sometimes when you roll over the monitor, the monitor will start flashing very fast, as if it can't make up it's mind whether or not it's invoved in a rollOver even or a rollOut event....this is not good for business...

some details:
the monitor is a movie clip called monitor_mc.... within the monitor_mc timeline, i have created a label for the up state, a label for the over state and a label for the out state... the over state is a shape tween and so is the out state. the up state does nothing, well it have a script that says stop();

on my main timeline i have a simple script on he first fram of the actions layer that reads

monitor_mc.onRollOver = function()
{
monitor_mc.gotoAndPlay("monitorBig");
}

monitor_mc.onRollOut = function()
{
monitor_mc.gotoAndPlay("monitorSmall");
}

//mainly i'm wondering if i'm even taking the right approach to creating a roll over event.... and i'm also wondering if it is possible to get the monitor to not flash like that.... i suppose i could've forgot a semicolon?

let me know if there is any more information i can give... thanks!
This topic has been closed for replies.

3 replies

Inspiring
October 4, 2006
also, i forgot one other thing...

why would i use _root.monitor_mc.gotoAndPlay("monitorSmall")? emphasis on _root because my label "monitorSmall" is within the monitor_mc timeline, not the root or main timeline... maybe i have my terminology mixed up...?

thanks again
Inspiring
October 4, 2006
hey, i appreciate the help, i have been looking into the hitMask code you gave me...

what i don't understand is why my monitor_mc MC wouldn't do exactly what the hitMask does? are you saying to make the hitMask the size of the monitor after it has grown from the rollOver? if i made the rollOut hitMask MC as big as the monitor, it seems like i would have un-necessary rollOut events? should the hitMask have the same tween effect as the monitor_mc MC or not?

thank you...
Inspiring
October 3, 2006
It appers that your problem is that you have a dynamic hitarea.
You can define the hitArea() (view help "hitArea" in flash) of the MovieClip,
or you can make an invisible movieclip named "hitMask" on top of all MC's.
and use this code:
hitMask.onRollOver = function()
{
_root.monitor_mc.gotoAndPlay("monitorBig");
}

hitMask.onRollOut = function()
{
_root.monitor_mc.gotoAndPlay("monitorSmall");
}