lz.CursorService
LzCursorService provides methods for changing the mouse cursor.

JavaScript: lz.CursorService
extends lz.Eventable »

lz.Cursor is the single instance of the class lz.CursorService.

This example shows how the cursor can be set on a view so that it will change when the mouse is over that view:

Example 21. Setting the cursor for a view

<canvas height="30">
   <resource name="waitcursor" src="resources/lzwaitcursor_rsc.swf"/>
   <view bgcolor="yellow" cursor="waitcursor">
     <text>Roll over to change the cursor</text>
   </view>
 </canvas>

This example changes the cursor for 1/2 second when the button is clicked:

Example 22. Changing the cursor with lz.Cursor

<canvas height="30">
   <resource name="waitcursor" src="resources/lzwaitcursor_rsc.swf"/>
   <button text="Click me to change the cursor for 1/2 second">
     <handler name="onclick">
       lz.Cursor.setCursorGlobal('waitcursor');
       var del = new LzDelegate(lz.Cursor, 'unlock');
       lz.Timer.addTimer(del, 500);
     </handler>
   </button>
 </canvas>

Class Attributes

Name (CSS property) Type (tag) Type (js) Default Category
LzCursor   lz.CursorService   readonly
  The cursor service. Also available as the global lz.Cursor.

Methods

lock()
lz.CursorService.lock();
Prevents the cursor from being changed until unlock is called.

restoreCursor()
lz.CursorService.restoreCursor();
Restores the default cursor if there is no locked cursor on the screen.

setCursorGlobal()
lz.CursorService.setCursorGlobal(resource : String);
Sets the cursor to a resource
Parameter Name Type Description
resource String The resource to use as the cursor.

showHandCursor()
lz.CursorService.showHandCursor(show : Boolean);
Shows or hides the hand cursor for all clickable views.
Parameter Name Type Description
show Boolean true shows the hand cursor for buttons, false hides it

unlock()
lz.CursorService.unlock();
Restores the default cursor.

Methods inherited from lz.Eventable

destroy, setAttribute

Events

Events inherited from lz.Eventable

ondestroy