Skip to Content
ActionScript: The Definitive Guide
book

ActionScript: The Definitive Guide

by Colin Moock
May 2001
Intermediate to advanced
720 pages
23h 24m
English
O'Reilly Media, Inc.
Content preview from ActionScript: The Definitive Guide

Name

Mouse.hide( ) Method — make the mouse pointer disappear

Availability

Flash 5

Synopsis

Mouse.hide( )

Description

The hide( ) method causes the normal mouse pointer (usually an arrow) to disappear when the mouse is over any part of the Player. The normal system pointer reappears when the mouse passes outside the Flash Player’s active stage area.

Usage

Note that in Flash 5, even after Mouse.hide( ) has been invoked, the normal system text I-beam cursor will appear when the mouse hovers over a text field.

Example

The hide( ) method is used to conceal the default system mouse pointer, typically in order to replace it with a custom pointer. In Flash, a custom pointer is nothing more than a movie clip that follows the mouse. Using the mouseMove event, we can cause a movie clip to follow the mouse by updating the clip’s _x and _ y properties with each passing frame. The following code demonstrates the technique:

// Code on the clip that acts as the custom pointer
onClipEvent (load) {
  Mouse.hide( );
}

onClipEvent (mouseMove) {
  _x = _root._xmouse;
  _y = _root._ymouse;
  updateAfterEvent( );
}

It may also be desirable to hide the custom pointer when the mouse is inactive, say, because the pointer has left the Flash Player’s active stage area, in which case the system pointer appears and there are two pointers on screen. The following code shows how to adapt the previous code to hide the cursor after 5 seconds of inactivity:

onClipEvent (load) { Mouse.hide( ); } onClipEvent (enterFrame) { if (getTimer( ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Actionscript Cookbook

Actionscript Cookbook

Joey Lott
ActionScript 3.0 Design Patterns

ActionScript 3.0 Design Patterns

William Sanders, Chandima Cumaranatunge

Publisher Resources

ISBN: 1565928520Catalog PageErrata