-- ROLLOVER CURSOR CHANGE -- -- PROPERTIES -- -- author-defined parameters property myCursorType property myBuiltInCursor property myCursorMember property myCustomCursor property myCustomMask -- internal properties property myCursor property mySavedCursor -- EVENT HANDLERS -- on beginSprite(me) me.initialize() end beginSprite on mouseEnter(me) mySavedCursor = sprite(0).cursor cursor myCursor end endSprite on mouseLeave(me) cursor mySavedCursor end mouseLeave -- CUSTOM HANDLER -- on initialize me mySavedCursor = sprite(0).cursor case myCursorType of VOID, "Built-in cursor": myCursor = myBuiltInCursor "Cursor member": myCursor= [value(myCursorMember).number] "1 bit bitmap": myCursor = [value(myCustomCursor).number] if myCustomMask <> "no mask" then myCursor.append(value(myCustomMask).number) end if end case end initialize -- UTILITY -- on getSuitableMembers(me, memberType) ------------------------------- -- Called by getPropertyDescriptionList() -- -- * Returns a list of members of a given type available to the -- current movie. If is #bitmap, the selection is -- limited to 1-bit members whose dimensions are less than 2Ox20 -- pixels. -------------------------------------------------------------------- membersList = [] maxCastLib = the number of castLibs repeat with theCastLib = 1 to maxCastLib maxMember = the number of members of castLib theCastLib repeat with memberNumber = 1 to maxMember theMember = member(memberNumber, theCastLib) if theMember.type = memberType then if memberType = #bitmap then -- Only allow small 1-bit bitmap members if theMember.depth > 1 then next repeat if theMember.width > 20 then next repeat if theMember.height > 20 then next repeat end if if theMember.name = EMPTY then membersList.append(theMember) else membersList.append(theMember.name) end if end if end repeat end repeat return membersList end getSuitableMembers -- AUTHOR-DEFINED PARAMETERS -- on isOKToAttach(me, spriteType, spriteNumber) return spriteType = #graphic end isOKToAttach on getPropertyDescriptionList(me) propertiesList = [:] cursorTypes = [] cursorMembersList = me.getSuitableMembers(#cursor) cursorBitmapsList = me.getSuitableMembers(#bitmap) cursorMasksList = cursorBitmapsList.duplicate() cursorMasksList.addAt(1, "no mask") cursorMembers = cursorMembersList.count() bitmapCursors = cursorBitmapsList.count() if cursorMembers then cursorTypes.append ("Cursor member") end if if bitmapCursors then cursorTypes.append ("1 bit bitmap") end if if cursorTypes.count() then cursorTypes.addAt (1, "Built-in cursor") propertiesList[ ¬ #myCursorType] = [ ¬ #comment: "CHOIX DE TYPE - Utiliser quel type de curseur ?", ¬ #format: #string, ¬ #range: cursorTypes, ¬ #default: cursorTypes[1]¬ ] propertiesList[ ¬ #myBuiltInCursor] = [ ¬ #comment: "CHOIX DE CURSEUR - Curseur intégré :", ¬ #format: #cursor, ¬ #default: 280¬ ] else return[ ¬ #myBuiltInCursor: ¬ [¬ #comment: "Choix de curseur", ¬ #format: #cursor, ¬ #default: 280¬ ] ¬ ] end if if cursorMembers then propertiesList[ ¬ #myCursorMember] = [¬ #comment: "- Acteur curseur :", ¬ #format: #member, ¬ #range: cursorMembersList, ¬ #default: cursorMembersList[1] ¬ ] end if if bitmapCursors then propertiesList[ ¬ #myCustomCursor] = [ ¬ #comment: "- 1-bit bitmap (image) :", ¬ #format: #bitmap, ¬ #range: cursorBitmapsList, ¬ #default: cursorBitmapsList[1]¬ ] propertiesList[ ¬ #myCustomMask] = [¬ #comment: "1-bit bitmap (masque) :", ¬ #format: #bitmap, ¬ #range: cursorMasksList, ¬ #default: cursorMasksList[1]¬ ] end if return propertiesList end on getBehaviorTooltip me return ¬ "Use with graphic sprites."&RETURN&RETURN&¬ "Changes the cursor when the mouse rolls"&RETURN&¬ "over a sprite. Use a built-in cursor, a"&RETURN&¬ "cursor member or customized 1-bit bitmap"&RETURN&¬ "members (16x16 pixels)." end getBehaviorTooltip on getBehaviorDescription return ¬ "ROLLOVER CURSOR CHANGE"&RETURN&RETURN&¬ "Changes the cursor when the mouse rolls over the current sprite. Choose one of Director's built-in cursors, a cursor member, or specify two 16x16 1-bit bitmap members: one to serve as the cursor image and the other to provide mask to define the transparent and opaques areas of the cursor."&RETURN&RETURN&¬ "TIP:"&RETURN&¬ "Place one pixel in the top right corner and another in the bottom left corner of the cursor image bitmap, to create a bitmap which is in fact 17x17 pixels. These additional pixels will not appear in the cursor image (they will be trimmed), but the mask will align on them. This allows you to ensure that there is an opaque area around the cursor."&RETURN&RETURN&¬ "Set the registration point of the image to define the cursor's hotspot."&RETURN&RETURN&¬ "PARAMETERS:"&RETURN&¬ " * EITHER - Use one of Director's built-in cursors."&¬ RETURN&RETURN&¬ " * OR - Use a cursor member"&RETURN&RETURN&¬ " * OR - Use your own 16x16 1-bit bitmap images as"&RETURN&¬ " * ... Cursor image"&RETURN&¬ " * ... Mask" end getBehaviorDescription