Lingo Tutorial: Cursor Changes

READING:
Technote: Setting the cursor Cursor list A, cursor list B

File "cursor_change.dir"

Shows how to invoke different default cursors 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"

Sometimes the size of your project requires that you are using multiple files. In such cases you want the cursors to be shared among all files. This example does the 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 26, 2009