Cursors (system and custom) in Director by Matt Ottewill

Introduction

It is useful to be able to change the cursor in a Director movie. For example you may want to indicate that a sprite is clickable by having the cursor change to the finger pointer cursor when it is rolled over. Director also gives you the ability to create custom cursors.

Cursor change scripts

Lingo scripts which change the cursor are very simple to create. This script changes the cursor to the crosshair cursor when the sprite is entered and back to the default operating system cursor when the mouse leaves..

on mouseEnter
cursor 2
end

on mouseLeave
cursor 0
end

NOTE: Cursor 200 makes the cursor invisible whilst Cursor 0 returns the cursor back to the default operating system cursor (which may differ between platforms).

System cursors

Systems cursors may be defined from the following table.

Custom cursors (Director)

Director can utilise custom cursors with masks created by the end user. Here's how ...

  1. In Photoshop create a new document with ... Mode = Bitmap, size = 16 x 16 pixels, Background = White, Colour = RGB

  2. Draw an outline shape in black leaving the centre white.

  3. Select it and copy it to the clipboard then paste it into Director internal Cast slot 1

  4. Double click it to open the Paint window and check that it has a bit depth of 1 (displayed below the tools). If it doesn't, double click the bit depth display, select Bit depth = 1-bit and Transform it.

  5. Now copy it in the cast and open the copy.

  6. Fill in the centre white area of the cursor with black. This bitmap will work as a mask.

  7. Use the following script to activate the cursor ...

on prepareMovie
cursor [1, 2]
end

Animated cursors (Director)

Director allows for 8-bit animated colour cursors 16 x 16 pixels in size. You can create bitmaps in Photoshop, import them into Director and then use Insert>Media Element>Cursor to create your animated cursor cast member. Give it a name and then use the following script to activate it ...

on prepareMovie
cursor member (member "cursorname")
end