Skip to main content
Known Participant
June 14, 2013
Question

Hiding the Mouse on Start of Movie

  • June 14, 2013
  • 1 reply
  • 2567 views

Hello All,

I have a flash program that runs on a PC that is connected to a TV. In case it helps at all, the PC is running OpenSuSE 12.1/KDE 4.

The PC is acting as a kiosk like device where no user is actually sitting at the PC doing stuff. If we ever need to do anything with it

we do it remotley using something like VNC or Remote Desktop or SSH, etc....

So what happens is when the PC is powered on it boots up and automatically logs in the default user. Then I set Firefox to start

automatically on boot and I set it's Homepage to the URL where the swf file lives (*which is located on another Server). Also, Firefox

automatically goes into Fullscreen mode mode using the Firefox Plugin "Full Fulscreen".

The issue is that, after the PC boots up and Firefox starts and the Flash movie begins playing, I can see the Mouse pointer sitting in the

middle of the screen which does NOT go away. So I found some code online that will hide the mouse after 'n' seconds. But the problem

is that when the Flash movie starts the mouse will NOT disappear after 'n' seconds. It is possible to get it to disappear, but in order to do

so I would have to tap the mouse so that it moves even the slightest, then after it stops moving it then disappears after 'n' seconds...

Since there really isn't any person who starts the movie manually, or since no one sitting in front of it with a mouse in their hand this won't

do what I wanted it to do....

Here is what I have so far in order to hide the mouse:

// Added this line after testing the code below. But still didn't hide the pointer when the movie was started

//Mouse.hide();                   // Hide the mouse automatically when started (*no time limit for this one)

var timeLimit:int = 3;         // Integer to hold what the Time Limit will be

// Add the EventListener for when the Mouse is moved:

stage.addEventListener(MouseEvent.MOUSE_MOVE, onMove);

// Create a Timer Object and multiply timeLimit by 1000 to get seconds:

var timer:Timer = new Timer(timeLimit * 1000);

// Add the EventListener for the Timer:

timer.addEventListener(TimerEvent.TIMER, onInactiveMouse);

// Function "onMove()":

//        *This will show the Mouse, stop the timer, then restart the timer...

function onMove(event:MouseEvent):void {

        trace("In onMove() --- Showing the Mouse Now...");

        Mouse.show();

        timer.stop();

        timer.start();

}


// Function "onInactiveMouse()":

//        *This will hide the Mouse when the TimeLimit has been reached...

function onInactiveMouse(event:TimerEvent):void {

        trace("In onInactiveMouse() --- Hiding the Mouse Now...");

        Mouse.hide();

}

So I guess my question is, is there a way to hide the mouse without a Human having to intervene and move the mouse pointer?

Also, I don't know if it was just some weird thing that happens, but say the movie is up and I move the mouse so it then disappears after n seconds.

Then the Frame changes and under where the mouse is hiding a TextField appears (*NOT an input TextField, just a Dynamic Text) suddenly the mouse

reappears, but it appears as the text selection pointer (*i.e. the one that looks like an Upper-Case "i"). And it won't disappear unless I move the pointer

again, Strange..!  I guess I could fix this by changing all my TextFields to be NOT selectable, but I was just curious if anyone else had experienced this?

Anyway, any thoughts/suggestions would be greatly appreciated!

Thanks in Advance,

Matt

This topic has been closed for replies.

1 reply

June 14, 2013

The Flash player doesn't have focus until you "interact" with it (in your case moving the mouse), which is probably why Mouse.hide() won't work right away. I would recommend trying JavaScript to hide the mouse instead. This might be helpful: http://stackoverflow.com/questions/1361404/web-browser-hide-mouse-cursor

mrm5102Author
Known Participant
June 14, 2013

Hey Stenrap2, thanks for the reply!

Ohh Ok that explains alot.

I kinda figured it was something with the "focus", I just couldn't think of the words to describe it. I figured that was probably it because

I know if your watching flash within Firefox for example, and you click somewhere in the movie you can no longer use shortcuts for the

firefox window, like F11 to turn-on/off fullscreen, ctrl-tab to switch tabs, etc.... So I figured it was something to do with having to click into

the window and put the "focus" on that. Thanks for the clarification!

Ok, I'll check out the link you posted. So I guess you can embed JavaScript within your flash movie?

Thanks Again,

Matt