all groups > flash actionscript > march 2005 >
You're in the

flash actionscript

group:

Detecting rollovers on a different layer?


Detecting rollovers on a different layer? a little ant
3/19/2005 4:43:59 PM
flash actionscript:
Whats the best way to detect any of 4 button rollovers on _level30 to help
determine if an mc on _level7 shows up yet or not right at the beginning of a
swf. (I have a text effect that shows up when level 30 btns are rolled over.
Level 7 has a page label in exactly the same place. Usually the _level30
rollover will fade out the _level7 label. However, when the level 7 swf
initially loads it overlaps if the user has their mouse over _level30 buttons.
I don't think I have detected a rollover of adifferent layer before from the
first keyframe of a different layer swf. I could maybe put a variable in the
rollover and rollout and then if the swf detects that variable then maybe it
could react that way? opinions please if you have any. Cheers.
Re: Detecting rollovers on a different layer? kglad
3/19/2005 5:08:08 PM
the title of your thread is misleading. you're talking about _levels and those
are different from layers.

if you only load a swf into _level7 once, to solve your problem you can use:

yourBtn.onRollOver=function(){
clearInterval(checkI);
checkI=setInterval(checkF,80);
// whatever
}
function checkF(){
if(_level7){
clearInterval(checkI);
// do whatever fade you want. _level7 is loaded
} else {
// if it's possible for your _level30 button to undergo a rollOver and NOT
have anything loading or loaded into _level7, you'll need to indicate that to
this function so it can clearInterval() without waiting for _level7 to load
}
}

Re: Detecting rollovers on a different layer? a little ant
3/19/2005 6:47:49 PM
Cheers. Forgive the reference to layers. That's a symptom of pulling another
`all nighter'. (It's 03.48 now. Japan) (if you check other messages - you will
see that I usually live at night.. if I can stay awake). I think my site
might be a little too complicated to use your actionscript just there. I will
have a try and see what i can do. Thanks. Maybe I could make something simpler.
I have 4 main pages to my site and they each load and or replace each other in
level7. On the first KF of each I have a label_mc (named label_mc) which is
simply a text effect of the name of each page. If the user is resting their
mouse over 3 of my buttons which exist on _level30 (one will always be
enabled=false after release) then I simply want to tell the label_mc (level7)
not to play or something. Else the 2 effects from each level overlap and look
silly. (Otherwsise they usually fade each other out nicely!)(However I mustn't
change the alpha of any label else that screws up my current setintervals) I
might be able to do this within the mc itself for each page. Unfortunately,
there is often a complication down the road without the luxury of hindsight in
advance). C'est la Vie! Question: Is it possible for the loading in swf
_level7 to move the cursor so that it isn't over the _level30 btn and therefore
switches off my rollover? That would buy me enough frames to then do what i
have to do. I could even maybe have it then move the cursor to the next
suggested button that the user should hit to continue (if they want). I know
Mouse.hide(); doesn't work obviously and I have tried also btn.enabled=false
etc. Sometimes I wish my site could hit the user in the face on complicated
nights like this. cheers as usual.
Re: Detecting rollovers on a different level? kglad
3/20/2005 3:35:36 PM
no, you can't move the mouse and as you've found disabling your button won't
work. what you could do is to reformulate your button code on _level30. so
instead of:

on(rollOut){
//do whatever
}

or

_level30_btn.onRollOut=function(){
// do whatever
}

you could use:

_level30_btn.onRollOut=whatever;
function whatever(){
//do whatever
}

now, you can execute that rollOut code by either rolling out of your button or
by calling _level30.whatever() from _level7 (or anywhere else).
Re: Detecting rollovers on a different level? a little ant
3/20/2005 5:32:14 PM
What I'm trying to do is actually force a rollout so that the level30 btn
rollover text effect is not in the way of my level7 page label text effect - If
the user happens to be resting the mouse on an active button while waiting /
loading of the level 7 swf.

There is a way. It's my noob (non actionscript way). I can tell level30 btn to
be _visible=false for just kF1. Thats kills the text effect just in time for
the loading in swf text effect. Then tell it to be visible true for KF2. I can
then have a dummy button for those frames on level 7 so you don't see a button
disappear. It's crude but it kills the rollover effect. When the button
reappears and induces a rollover it doesn't matter because it doesn't overlap
any other effect and blends in with page loading stuff. Thanks. All of your
help and I wish I could repay the favor.

Not sure if it will screw up any setIntervals. I'll try it.

Re: Detecting rollovers on a different level? kglad
3/20/2005 8:54:12 PM
my code forces a rollOut. except the mouse pointer doesn't move and is still
over any button that it happened to be over at the time whatever() is called.
however, all the code that normally would be executed on rollOut would still be
executed.
Re: Detecting rollovers on a different level? a little ant
3/21/2005 6:40:51 AM
ok Thanks. I didn't see that your code did that so I didn't try it. I will try it ... cheers.
Re: Detecting rollovers on a different level? a little ant
3/21/2005 9:30:04 AM
How would I then kill that function so that it doesn't exist some keyframes
later?
(So that once my lefvel 7 swf has fully loaded - I can then normally use my
level 30 nav buttons again).

Cheers. (What are you really cr@p at? Anything?)
Re: Detecting rollovers on a different level? kglad
3/22/2005 2:50:33 AM
you wouldn't kill that function. just keep using it to execute your rollOut
code. your buttons will function normally with that code. that code simply
gives you one more option so you can execute that rollOut code without
requiring a rollOut to be detected.
AddThis Social Bookmark Button