Contents
Articles
Behaviors
Books
Director News
Director Web Sites
FAQ
Games
Mailing Lists
News Groups
Project Examples
Reviews
Software
Tools
Useful Web Sites
Utilities
Xtras

Don't miss these
Animated Cursor
Get Font List without using xtras!
DirectInteraction Xtra
Object Serializer
Hold for MPEG then go to marker X
RGB to CMYK
Sharp Image Export Xtra
nCrypt
Resolution Xtra
Saving Data in Shockwave
 

 

 

Behavior Marks button, 4 picts with rollover, rolloff

Added on 6/10/1999

 

Compatibilities:
behavior D6_5 Mac PC

This item has not yet been rated

Author: MarkHagers

Marks button, 4 picts with rollover, rolloff

property upMember, downMember, insideMember, disMember, enabled, active, mouseUpScript, cursorMember

on getBehaviorDescription
  return "Button behaviour, by Mark Hagers." & return & " 1997 Mediaeval Multimedia, Nijmegen, the Netherlands." & return & "email: mark@mediaeval.nl" & return & "Handles mouse enter and mouse leave events, proper button behaviour on mousedown and enabling and disabling the button." & return & "The parameters for this behavior:" & return & " - MouseOver/MouseDown/Disabled pictures: the cast members for the corresponding button states." & return & "   (the cast member of the sprite in the score becomes the standard button bitmap." & return & " - Cursor member: any 1-bit cast member. The behavior will check for a bitmap with the same name and '.mask' appended." & return & "   If one is found it will be used as the cursor mask." & return & " - Initially enabled: whether the button is enabled (clickable) at the start." & return & " - Handler: the lingo command (or handler name) to be executed when a valid mouse up event occurs." & return & "Lingo command to enable/disable the button: 'enable sprite n'/'disable sprite n'" & return & "Toggle command (toggles between enabled and disabled states): 'toggle sprite n'."
end

on getPropertyDescriptionList
  set description = [:]
  if the currentspritenum = 0 then
    set indefault = 0    
    set downdefault = 0    
    set disdefault = 0    
  else
    set memref = the member of sprite the currentspritenum
    set castlibnum = the castlibnum of memref
    set indefault = member (the membernum of member memref + 1) of castlib castlibnum
    set downdefault = member (the membernum of member memref + 2) of castlib castlibnum
    set disdefault = member (the membernum of member memref + 3) of castlib castlibnum
    set cursorList = []
    repeat with i = 1 to the number of members
      if the type of member i = #bitmap then
        if the depth of member i = 1 then add cursorList, the name of member i
      end if
    end repeat
    if count(cursorList) > 0 then
      set cursDef = getAt(cursorList,1)
    else set cursorList = [#none]
  end if
  
  addProp description, #insideMember,
           [#default:indefault,#format:#bitmap,#comment:"MouseOver picture:"]
  
  addprop description, #downMember,  
           [#default:downdefault,#format:#bitmap,#comment:"MouseDown picture:"]
  
  addprop description, #disMember,  
           [#default:disdefault,#format:#bitmap,#comment:"Disabled picture:"]
  
  addprop description, #cursorMember,  
           [#default:cursDef,#format:#bitmap,#comment:"Cursor image:",#range:cursorList]
  
  addprop description, #enabled,  
           [#default:true,#format:#boolean,#comment:"Initially enabled:"]
  
  addprop description, #mouseUpScript,  
           [#default:"",#format:#string,#comment:"Button command:"]
  
  return description
end

-----

on beginSprite me
  set the upMember of me = the member of sprite (the spriteNum of me)  
  if not the enabled of me then
    set the member of sprite (the spriteNum of me) to member the disMember of me
  else if not voidP(cursorMember) then
    setCursor me, true
  end if
end

on mouseDown me
  if the enabled of me then
    set the member of sprite (the spriteNum of me) to member the downMember of me
    set active = true
  end if
end

on mouseEnter me
  if the enabled of me then
    if the mouseDown and the active of me then
      set the member of sprite (the spriteNum of me) to member the downMember of me
    else set the member of sprite (the spriteNum of me) to member the insideMember of me
  end if
end

on mouseLeave me
  if the enabled of me then set the member of sprite (the spriteNum of me) to member the upMember of me
end

on mouseUp me
  if the enabled of me and active = true then
    set the member of sprite (the spriteNum of me) to member the insideMember of me
    do mouseUpScript
  end if
  set active = false
end

on mouseUpOutside
  set active = false
end mouseUpOutside

on disable me  
  set the enabled of me = false
  set the member of sprite (the spriteNum of me) to member the disMember of me
  setCursor me,false
end

on enable me  
  set the enabled of me = true
  set the member of sprite (the spriteNum of me) to member the upMember of me
  setCursor me,true
end

on toggle me
  if the enabled of me then
    disable me
  else enable me
end

on setCursor me, theVal
  if theVal then
    put the number of member cursorMember into theCurs
    put the number of member(the name of member cursorMember & ".mask") into theMask
    if theMask > 0 then
      set the cursor of sprite (the spriteNum of me) = list(theCurs, theMask)
    else set the cursor of sprite (the spriteNum of me) = list(theCurs)
  else set the cursor of sprite (the spriteNum of me  ) = 0
end  

 


Contact

MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA

Send e-mail