|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Swf working great not so great the html
Dear all,
Here's the story of a simple menu: when your mouse is over the menu button, the panel with the menu choices appears and your mouse can travel around the panel. As soon as you leave the panel with your mouse, the panel disappears. This is happening in the swf that is called menu_ee and is here: aracelid.110mb.com/test But when you visit the html and your mouse goes out of the panel, a lot of times the panel does not disappear. The html is also called menu_ee and it's in the same path as the swf. What is going wrong? My publishing settings in the HTML tab: Flash Only Match Movie. Loop Display menu High quality Transparent without windows Default Default Alignment center center Thanks a lot in advance!! |
|
#2
|
|||
|
|||
|
Hi, it's probably because you're rolling out of the entire Flash movie so quickly that the onRollOut event isn't being registered. I've had that happen before in the past.
A simple way around that is to use setInterval to keep checking if the mouse is over the menu. The idea is that you record the mouse position and compare it with the next time the function is called. If the two values match then the mouse hasn't moved so close the menu. The logic behind that is that it's usually quite hard to keep the mouse in the exact same position for very long, it often moves a pixel or two up/down/left/right when you're trying to hold it still. If you mouse out of the entire Flash area then the registered mouse point will remain the same until you mouse over it again. |
|
#3
|
|||
|
|||
|
Woah! Thanks Tann!! Is there any tutorial that can show me how to do that? I'm afraid is quite out of my scope and I need the menu working properly
![]() Thanks again! |
|
#4
|
|||
|
|||
|
I don't know of any tutorials covering that, it's just something I came up with on my own when I ran into that issue. Here's the code you'll need:
Code:
// Start checking the mouse position
// This line should be inside the event handler you use to open the sub menus
_root.int_rolled_out = setInterval(_root, checkMouse, 10000);
// Stick this on the first keyframe of the main timeline
function checkMouse():Void
{
var mouse_so:SharedObject = SharedObject.getLocal("mouseChecker");
if(mouse_so.data.xmouse != undefined)
{
if (mouse_so.data.xmouse == _root._xmouse && mouse_so.data.ymouse == _root._ymouse)
{
// Mouse is in same position so close menu
clearInterval(_root.int_rolled_out);
}
else
{
// Mouse has moved so store the new mouse position
mouse_so.data.xmouse = _root._xmouse;
mouse_so.data.ymouse = _root._ymouse;
mouse_so.flush();
}
}
else
{
// This is the first time we create the SO so store the new mouse position
mouse_so.data.xmouse = _root._xmouse;
mouse_so.data.ymouse = _root._ymouse;
mouse_so.flush();
}
}
You put that first line after the comment inside whatever mouse event you're using to open the submenu. That will start the checking process. It will keep firing off every 10000 milliseconds (unless you change that value). If you do close the submenu then you need to copy this line into there as well: clearInterval(_root.int_rolled_out); which will stop it checking the mouse position. That should be all the code you need but you might have to re-hash it to fit your scenario. The function I wrote should be placed on the first keyframe of the main movie. |
![]() |
| Viewing: Dev Shed Forums > Web Design > Flash Help > Swf working great not so great the html |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|