主题:  鼠标的形状如何改变???

plague

职务:普通成员
等级:1
金币:0.0
发贴:9
注册:2001/1/31 13:32:21
#12001/2/2 9:03:15
在FLASH中做的按钮,在DIRECTOR8中使用,鼠标老是箭头状,请问如何与在FLASH里一样,变成手指状

谢谢



Call Me Simon

职务:普通成员
等级:2
金币:2.0
发贴:646
注册:2000/9/19 13:56:51
#22001/2/2 9:52:04
用mouseOverButton属性。

...
if sprite( flashSprite).mouseOverButton then 
    sprite( flashSprite).cursor = 280
  else
    sprite( flashSprite).cursor = -1
end if 
...



skys

职务:普通成员
等级:1
金币:0.0
发贴:94
注册:2000/12/21 16:20:28
#32001/2/2 15:37:27
我照着做了个试验,不知道为什么老是不行,程序如下:
—————————————————————————————————————————————————
on beginsprite me
if sprite(me.spritenum).mouseOverButton then
sprite(me.spritenum).cursor = 260
else
sprite(me.spritenum).cursor = -1
end if
end
—————————————————————————————————————————————————
哪位帮助给诊断一下



Call Me Simon

职务:普通成员
等级:2
金币:2.0
发贴:646
注册:2000/9/19 13:56:51
#42001/2/2 16:30:59
用exitFrame handler.

on exitFrame me
  if sprite(me.spritenum).mouseOverButton then
    sprite(me.spritenum).cursor = 280
  else    
    sprite(me.spritenum).cursor = -1
  end if
end

编辑历史:[这消息被flyingbird编辑过(编辑时间2001-02-02 16:32:05)]


我就是我

职务:版主
等级:6
金币:14.0
发贴:5466
注册:2004/1/13 17:02:03
#52001/2/2 21:56:34
把它切割成按钮,加入
-- DESCRIPTION --

on getBehaviorDescription me
  return     "ROLLOVER CURSOR CHANGE" & RETURN & RETURN &     "Changes the cursor when the mouse rolls over the current sprite. " &     "Choose one of the pointers included with Director, or specify two 1-bit 16x16 pixel bitmap members: one to act as the pointer image, the other to define the transparent/opaque areas of the cursor." & RETURN & RETURN &     "TIPS:" & RETURN &     "Place a single pixel at the topRight and bottomLeft of the image itself to create what is in fact a 17x17 pixel bitmap. " &     "These extra pixels will not appear in the cursor (they will be clipped) but the mask will align with them. " &     "This ensures that the opaque area surrounds the cursor image correctly." & RETURN & RETURN &     "Set the regPoint 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 your own bitmap images." & RETURN &     "* Custom Image " & RETURN &     "* Custom Mask" & RETURN & RETURN &     "To use custom images, ensure that " & QUOTE & "1 bit bitmap" & QUOTE & " is selected as the type of cursor."
end getBehaviorDescription


on getBehaviorTooltip me
  return     "Use with graphic members." & RETURN & RETURN &     "Modifies the cursor when the mouse rolls over a sprite." & RETURN & RETURN &     "You can use built-in or custom images for the cursor."
end getBehaviorTooltip



-- PROPERTIES --

property spriteNum
-- author-defined parameters
property myCursorType
property myBuiltInCursor
property myCursorMember
property myCustomCursor
property myCustomMask
-- internal properties
property mySprite
property mySavedCursor


-- EVENT HANDLERS --

on beginSprite me
  SetSpriteCursor me
end beginSprite


on endSprite me
  mySprite.cursor = mySavedCursor
end endSprite



-- CUSTOM HANDLER --

on SetSpriteCursor me
  
  mySprite = sprite (me.spriteNum)
  -- Save cursor to revert to
  mySavedCursor = mySprite.cursor
  
  -- Set the cursor of the sprite
  if voidP (myCursorType) then
    mySprite.cursor = myBuiltInCursor
    exit
  end if
  
  case myCursorType of
    "Built-in cursor":
      mySprite.cursor = myBuiltInCursor
    "Cursor Member":
      myCursorMember = value (myCursorMember) 
      cursorList = [myCursorMember.number]
      mySprite.cursor = cursorList
    "1 bit bitmap":
      myCustomCursor = value (myCustomCursor) 
      cursorList = [myCustomCursor.number]
      if myCustomMask <> "no mask" then
        myCustomMask = value (myCustomMask) 
        cursorList.append(myCustomMask.number)
      end if
      mySprite.cursor = cursorList
  end case
end SetSpriteCursor



-- AUTHOR-DEFINED PARAMETERS --

on isOKToAttach (me, aSpriteType, aSpriteNum)
  case aSpriteType of
    #graphic:
      return TRUE
    #script:
      return FALSE
  end case
end isOKToAttach

on getPropertyDescriptionList me
  
  if not the currentSpriteNum then exit
  
  propertyDescriptionList = [:]
  cursorTypes = []
  cursorMembersList = GetCursorMembers (me)
  cursorBitmapsList = GetCursorBitmaps (me)
  cursorMasksList = duplicate (cursorBitmapsList)
  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")
    propertyDescriptionList.addProp (  #myCursorType,  [  #comment: "CHOICE OF TYPE - Use which type of cursor?",   #format:  #string,   #range:    cursorTypes,   #default:  cursorTypes[1] ] )
    
    propertyDescriptionList.addProp (  #myBuiltInCursor,  [  #comment: "CHOICE OF CURSOR   -               Built-in cursor:",   #format:  #cursor,   #default:  280 ] )
  else
    return [  #myBuiltInCursor:  [  #comment: "Use which cursor?",   #format:  #cursor,   #default:  280 ] ]
  end if
  
  if cursorMembers then
    propertyDescriptionList.addProp (   #myCursorMember,  [  #comment: "-             Cursor member:",   #format:  #member,   #range:    cursorMembersList,   #default:  cursorMembersList[1]  ] )
  end if
  
  if bitmapCursors then
    propertyDescriptionList.addProp (  #myCustomCursor,  [   #comment: "-   1 bit bitmap (image)",   #format:  #bitmap,   #range:    cursorBitmapsList,   #default:  cursorBitmapsList[1] ] )
    
    propertyDescriptionList.addProp (  #myCustomMask,  [   #comment: "1 bit bitmap   (mask)",   #format:  #bitmap,   #range:    cursorMasksList,   #default:  cursorMasksList[1] ] )    
  end if
  
  return propertyDescriptionList
end


on GetCursorMembers me
  cursorMembersList = []
  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 = #cursor then
        if theMember.name = EMPTY then
          cursorMembersList.append(theMember)
        else
          cursorMembersList.append(theMember.name)
        end if
      end if
    end repeat
  end repeat
  return cursorMembersList
end GetCursorMembers


on GetCursorBitmaps me
  cursorBitmapsList = []
  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 = #bitmap then
        if theMember.depth > 1 then next repeat
        if theMember.width > 20 then next repeat
        if theMember.height > 20 then next repeat
        
        if theMember.name = EMPTY then
          cursorBitmapsList.append(theMember)
        else
          cursorBitmapsList.append(theMember.name)
        end if
      end if
    end repeat
  end repeat
  return cursorBitmapsList
end GetCursorMembers

就可以了,当然这里有好多可以不要,那你自己去掉好了

请使用禁止笑脸转换, 或使用code tag.
flyingbird

编辑历史:[这消息被flyingbird编辑过(编辑时间2001-02-03 14:46:41)]
[这消息被flyingbird编辑过(编辑时间2001-02-03 14:48:16)]