Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 03-07-2004, 04:59 PM   #1
cytone
Registered User
 
Join Date: Mar 2004
Posts: 5
Default Mouse Position

Hey

I am using drop down menus with invisible buttons to open and close the menus. When I roll outside the canvas area (e.g. Outside the actual SWF ) sometimes the menu sticks on the open state.

Is there a way to write code for the following: If mouse is outside the canvas, close all menus?

Thanks Kindly
cytone
cytone is offline   Reply With Quote
Old 03-07-2004, 05:05 PM   #2
divarch
Not a teenager
 
divarch's Avatar
 
Join Date: Nov 2003
Location: Belgrade, Serbia
Posts: 618
Send a message via MSN to divarch Send a message via Yahoo to divarch
Default

'onRollOut' or 'on(rollout)'
Welcome
divarch is offline   Reply With Quote
Old 03-07-2004, 06:19 PM   #3
cytone
Registered User
 
Join Date: Mar 2004
Posts: 5
Default

Thanks...

This is my code.

_global.isopen=false;

_global.OpenMenu=function(menuname)
{
if (_global.isopen==false)
{
_global.isopen=true;
eval("_root."+menuname).gotoAndPlay("over");
}
}

_global.CloseMenu=function(menuname)
{
if (_global.isopen==true)
{
_global.isopen=false;
eval("_root."+menuname).gotoAndPlay("out");
}
}

ON THE MENU BUTTON:

on (rollOver) {
_global.OpenMenu("mainmenu");
}

Im not sure how to add the on(rollout) so that menus will close if Im outside the canvas. Any ideas...?

Thanks
cytone is offline   Reply With Quote
Old 03-07-2004, 08:12 PM   #4
cytone
Registered User
 
Join Date: Mar 2004
Posts: 5
Default tracking the mouse position

HI

Sorry to be impatient, but so far no one has been able to help! Would really appreciate some feedback here....

I am using the following code to control the "open" / "closed" state of a drop down navigation. There are two navs in total.
_global.isopen=false;

_global.OpenMenu=function(menuname)
{
if (_global.isopen==false)
{
_global.isopen=true;
eval("_root."+menuname).gotoAndPlay("over");
}
}

_global.CloseMenu=function(menuname)
{
if (_global.isopen==true)
{
_global.isopen=false;
eval("_root."+menuname).gotoAndPlay("out");
}
}

I have an invisible button that controls the "rollout" state and the following code to control the "rollOver" state. ("mainmenu") is replaced by ("roammenu") on the other menu.

ON THE MENU BUTTON:

on (rollOver) {
_global.OpenMenu("mainmenu");
}

PROBLEM - when I roll out of the canvas or SWF sometimes the menus stick open. I need to find a way to: close all open menus if someone rolls out of the canvas and somewhere onto the HTML page.

Any help would be wicked.....!

Thanks
cytone is offline   Reply With Quote
Old 03-07-2004, 09:15 PM   #5
annexion
I make out with chicks
 
Join Date: Oct 2002
Location: NYC
Posts: 1,586
Default

Divarch, Flash does not currently have support to track objects outside of the swf. A rollout event will not solve the problem. Frankly, there's no real way to bulletproof someone from rolling out of the stage fast enough to preempt the rollOut actions.
__________________
www.perpetuated.com
annexion is offline   Reply With Quote
Old 03-07-2004, 09:51 PM   #6
Abelius
Worldkit Vote Holder
 
Abelius's Avatar
 
Join Date: May 2002
Location: Miami - USA
Posts: 816
Send a message via Yahoo to Abelius
Default

I think that's way too complicated...

And why do you use the global for such a little thing... "_root." would more than do...

Here is what I think:

if (_root.anyVariable) {
doSomething();
} else {
doSomethingElse();
}

or:

if (!menuOn) {
makeSuremenuesSontStickOpen()
} else {
selectedmenuShouldBeOpen()
}

and then on the movieClip that contains your buttons:

on (mouseOver) {
menuOn = true
}
on (mouseOut) {
menuOn = false
}
__________________
Cordially,
Abelius
Commuting between Birmingham, AL, Miami, FL and Beijing, China
http://www.worldkit.com
Abelius is offline   Reply With Quote
Old 03-08-2004, 01:26 AM   #7
divarch
Not a teenager
 
divarch's Avatar
 
Join Date: Nov 2003
Location: Belgrade, Serbia
Posts: 618
Send a message via MSN to divarch Send a message via Yahoo to divarch
Default

Thanks annexion for making me look at the original q again! I missed the 'outside .swf' part
So, @cytone:
Outside the canvas: no! At least not bulletproof.

But, as almost always, Flash can be worked around. You could try with setting the interval for a 'isopen' status check, then if false for some time, close all menus.
It could work, now just trying to incorporate it in your code.
divarch is offline   Reply With Quote
Old 03-08-2004, 01:39 AM   #8
divarch
Not a teenager
 
divarch's Avatar
 
Join Date: Nov 2003
Location: Belgrade, Serbia
Posts: 618
Send a message via MSN to divarch Send a message via Yahoo to divarch
Default

A bit different than what I had in mind, but you can try this:
PHP Code:
on (rollOver) {
    
clearInterval(closeInt);
    
_global.OpenMenu("mainmenu");
}
on (rollOut) {
    
closeInt setInterval(_global.CloseMenu1000"mainmenu");

divarch is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:11 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.