This content has been marked as final. Show 13 replies
If I understand what you're doing correctly, then I think you need to use the movieclip.hitTest method with usage 1 (in livedocs). You would use this for the movieclip in the background of the buttons in your flyout menu. The mouse coordinates serve as the x and y co-ordinates for the parameters (from memory I think you need to use _root._xmouse and_root._ymouse). You would need to check this repeatedly after the flyout in either an onMouseMove or onEnterFrame event... If the hitTest is false then you're no longer on the flyout clip and you can tell it to retract
Did you try an "on (rollOut)"?
use can use an onMouseMove method to check your mouse position and determine if it's in the region where your menu should show or not.
I've tried the onMouseMove, but I also need it to see that I am no longer on the hitarea and go somewhere else. I have used a trace and it shows when I'm over the hit area, but the trace shows nothing when I move out of the hitarea.
I've had so many variations that I can't seem to find the current one. The attached is close.
This works if you just have the actions on a frame and photohit clip on the main timeline.
GWD: Thank you for taking the time to look at this but, what is the code to make it go to frame 1 when it is not over the hitarea? (or did I get that right?).
just replace my trace action
trace("not over the photohit") with yours:
[I'm going to sleep now where I am in the world, so others may need to follow up]
GWD: Thank you for your time, solved my problem, at least in one scenario. This is a perfect case of over-thinking, your solution was so simple it would have evaded me for quite some time. I just have to unload the listener so it is not always active, but that, I think I can do.
Again, thank you.
You're welcome. And yes it makes sense to remove the listener when the clip retracts. You would need to add the listener again everytime you needed it when photohit 'appears' again. I would aim to add the listener again whenever the mouse is over the the photohit clip each time it reappears - this means you need to wait until you roll off your main menu onto it to add the listener again or if you do add it back earlier you will have to code around the fact that the mouse is not already on the photohit clip yet in your listener.
And don't worry, its always the simple things that make life complicated [if that makes sense?]. I frequently over-complicate things myself and have learnt heaps of simple approaches from others here in the forums.
Just working on a setInterval so that the listener will only update every ½ second. Gots to cool down the CPU load.
I cannot seem to get the set interval to work, any ideas about my mistake here?
you shouldn't need setInterval, and its incorrectly set up. If you wanted to use a setInterval call instead of the onMouseMove event then you could do it as follows (but its NOT good programming, just providing it for illustrative purposes)
remove the line Mouse.addListener... etc (you wouldn't do both an onMouseMove check and a setInterval check)
and put in
var ML = setInterval(mouseListener,"onMouseMove",500);
That should work... I haven't tested it. Nor do I recommend it. I think you're better off with onMouseMove.
If you are going to use the setInterval its better to change the name of the onMouseMove everywhere that it appears to something like onIntervalCheck just so it makes more sense to you if you look at it later on (or for someone else too). Using onMouseMove shouldn't be too demanding on the CPU - and if its noticeable it should only be for very short bursts.
BTW You can also delete or comment out the trace actions... they were just there to help you understand how it works. Best not to leave them in when you do a final publish (or exclude trace actions in your publish settings)
GWD: Thank you for checking in.
Thinking about it, the setInterval would create another problem with the menu system (minor).
I was thinking about this only in that 'code optimization' is the charge call in most of the tuts that I have read, but being that the action is only updated when the mouse moves, the overhead is not that high. So the problem is now solved and I thank you for that.
Have a good year!