Lingo Tutorial: Cursor Changes

READING:
Using preset cursors (Chapter 11, pages 376-382)
Creating/Using custom cursors (Chapter 11, pages 382-386)
Technote: Setting the cursor Cursor list A, cursor list B
Cursor command and property (Appendix C, pages 794-795)
Managing multiple casts (Chapter 13, pages 448-453)

File "cursor_change.dir"

Shows how to invoke different default cursors (D8D page 377) and to implement a variety of cursor changes over sprites. Note that cursors should have 1-bit color depth and be no larger than 16x16 pixels in size.

on enterFrame
   upArrow = [1,2]
   -- 1 is the cast member of the 16x16 bit cursor
   -- 2 is the cast member of the mask
   -- change 2 to 1 to observe the "transparency" of the pointer
 
   transparent_upArrow = [1,1]
   black_upArrow = [2,2]
 
   -- the following tells over which sprite to change the pointer
   sprite(1).cursor = upArrow
   sprite(2).cursor = transparent_upArrow
   sprite(3).cursor = black_upArrow
 end 
File "cursors_shared.dir"

Same action as the previous example, but it uses shared cast members. Cursors and navigational icons are usually implemented in shared casts to allow consistency and flexibility in programming. You can refer to multiple cast libraries using the castLib number or name (1 is the internal one, 2 is the shared)
on enterFrame
      upArrow = [member 1 of castLib 2, member 2 of castLib 2] 
      sprite(1).cursor = upArrow
 end

 

 

Maintained By: Takis Metaxas
Last Modified: October 29, 2007