flash : mouse vanish on return to stage
- Started
- Last post
- 14 Responses
- wwfc
...anyone know my mouse cursor is vanishing on return to the stage area.
I have a movie clip on the stage with 8 frames in it - seven of which use this script to decide if the mouse should be showing and the cursor mc is 0% alpha
stop();
Mouse.show();
_root.PC_Cursor._alpha = 0;and this script that tells the cursor mc to be 100% alpha and the real mouse is hidden:
stop();
Mouse.hide();
_root.PC_Cursor._alpha = 100;This seems to work fine and exactly as I want it to - until the user's mouse leaves the stage and then returns to the stage - for some reason the mouse/mc vanishes totally!
If the user manages to click on a button in the nav the cursor/mc is visible.
How do I get around the problem of leaving and returning to the stage
...any ideas?
- fyoucher10
use the prop _visible instead of _alpha for a start.
i.e.
PC_Cursor._visible = false;Not sure why you would have 7 frames with that specific code in it, but maybe rethink what you're trying to do and see if there's a better solution.
- kult0
Agreed with above poster. If you have 7 keyframes each repeating the exact same chunk of code, you need to entirely rethink your design/code approach
- fyoucher10
Yeh, sounds like you're trying to make a switch (on and off).
You can easily make something that that by just calling the following:_root.PC_cursor._visible = !_root.PCCursor._visible;
Basically, if its visible then it makes it invisible. If its invisible, then it makes it visible.
And I wouldn't use _root either.
- wwfc0
I hear you - but the way it is done makes life easier.
As a rule I don't like to use root either but circumstances dictate!All I want to do is have the real mouse showing on the seven keyframes but the fake cursor on frame eight - and then back to the real cursor once the other frames play!
It all works apart from when the mouse exits and returns to the stage!
I am really confused by this - and I can't find any ref's to similar problems! Any suggestions welcomed!
- flashbender0
Is there a cat off stage?
- wwfc0
...now there's a thought...
lol!
- utopian0
Redesign the entire site in Powerpoint, will solve all problems.
- maximillion_0
the cursor goes off stage when its hidden (ie the ani hasnt got to frame 8 yet) - and so its still hidden when it returns. that sounds like yr problem
- fyoucher10
Not that this is a recommended solution but it will fix the problem:
var mouseChecker = this.createEmptyMovieClip("mouse... this.getNextHighestDepth());
mouseChecker.onEnterFrame = function():Void {
if(movieclipA._currentframe >= 8){
_root.PC_cursor._visible = true;
} else {
_root.PC_cursor._visible = false;
}Change movieclipA to whatever the instance name for the clip that has those 8 frames in it is. Place this code on the timeline wherever youyr put code (assuming you're adding code to the timeline).
Again, this is not a recommended solution but it should work.
- wwfc0
cheers fyoucher1 is that all the code or is there still some cut off?
var mouseChecker = this.createEmptyMovieClip("mouse... this.getNextHighestDepth());
mouseChecker.onEnterFrame = function():Void {
if(movieclipA._currentframe >= 8){
_root.PC_cursor._visible = true;
} else {
_root.PC_cursor._visible = false;
}
- fyoucher10
Some is getting cutoff.
Where the ellipses are should be "mouseChecker,"
without the quotes, just mouseChecker and a comma.Then add an extra bracket at the end }, so there should be two brackets at the end of all of that code }}
And you need to change movieclipA's name to what you already have
- lvl_130
use this fyoucher:
http://pastebin.coconut.se/
- wwfc0
...yes, please, could you drop it into pastebin - I'm bound to f*ck up otherwise!
http://pastebin.com/
be grateful if you could