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
MIDIio
Set ImageEnabled Property of a Flash Member
Increase/ Decrease Digital Video Volume
Open File with associated extension.
Count Down Timer
asFFTFile
Director 8 & Lingo Fast and Easy Web Development (With CD-ROM)
Relative Links
DirectControl Xtra
All purpose status bar
 

 

 

Behavior Multi-State Toggle Button

Added on 6/24/2000

 

Compatibilities:
behavior D7 D8 Mac PC Shockwave

This item has not yet been rated

Author: KumarK

Multi-State Toggle Button

---- written for Director 8 ---
---- Kumar.K ----
---- kumark@icode.com ----

------ Custom Properties ------
property  spritenum,offroll,offstandard,offdown,onstandard,onroll,ondown,RolloverCursor

------ Get Behavior Description List ------
on getPropertyDescriptionList me
  set description = [:]
  if the currentspritenum = 0 then exit
  theMember = sprite(the currentSpriteNum).member
  theMemberNumber = theMember.number    
  addProp description, #offstandard, [#comment: "-OFF STATE--Set Standard Member To :" ,#format:#Graphic,#default:member(theMemberNumber)]    
  addProp description, #offroll, [#comment: "-OFF STATE--Set Rollover Member To :" ,#format:#Graphic,#default:member(theMemberNumber+1)]    
  addProp description, #offdown, [#comment: "-OFF STATE--Set Mousedown Member To :" ,#format:#Graphic,#default:member(theMemberNumber+2)]    
  addProp description, #onstandard, [#comment: "-ON STATE--Set Standard Member To :" ,#format:#Graphic,#default:member(theMemberNumber+3)]    
  addProp description, #onroll, [#comment: "-ON STATE--Set Rollover Member To :" ,#format:#Graphic,#default:member(theMemberNumber+4)]    
  addProp description, #ondown, [#comment: "-ON STATE--Set Mousedown Member To :" ,#format:#Graphic,#default:member(theMemberNumber+5)]    
  addProp description, #RolloverCursor, [#comment: "Set RollOver Cursor :",#format:#cursor,#default:280]  
  return description
end getPropertyDescriptionList
------ Get Behavior Description List ------

-- Get Behavior description --
on getBehaviorDescription me
  return "Multi-State Button"  & RETURN & RETURN &
    "Change Cursor & Memer On Rollover and Click" & RETURN & RETURN &
    "This behavior toggles the sprite it is attached to between two states: OFF and ON."  & RETURN & RETURN &
    "PARAMETERS:" & RETURN &
    "* OFF STATE Standard Member" & RETURN &
    "* OFF STATE Rollover Member" & RETURN &
    "* OFF STATE Mousedown Member" & RETURN &
    "* ON STATE Standard Member" & RETURN &
    "* ON STATE Rollover Member" & RETURN &
    "* ON STATE Mousedown Member" & RETURN &
    "* Rollover Cursor"
end getBehaviorDescription
-- Get Behavior description --


------ Availbale for only Sprite Script ------
on isOKToAttach (me, aSpriteType, aSpriteNum)
  case aSpriteType of
    #graphic:
      return true
    #script:
      return false
  end case
end isOKToAttach
------ Availbale for only Sprite Script ------

-- Events --
on mousewithin
  sprite(spritenum).cursor = RolloverCursor
  if  member(sprite(spritenum).member) = offstandard then
    sprite(spritenum).member = offroll
    updatestage
  end if
  if  member(sprite(spritenum).member) = onstandard then
    sprite(spritenum).member = onroll
    updatestage
  end if
end
on mouseleave
  if  member(sprite(spritenum).member) = offroll  then
    sprite(spritenum).member = offstandard
    updatestage
  end if
  if  member(sprite(spritenum).member) = onroll  then
    sprite(spritenum).member = onstandard
    updatestage
  end if
  sprite(spritenum).cursor =  0
  updatestage
end

on mouseoutside
   sprite(spritenum).cursor =  0
  updatestage
end

on mousedown
  if member(sprite(spritenum).member) = offroll then
    sprite(spritenum).member = offdown
    updatestage
  end if
  if member(sprite(spritenum).member) = onroll then
    sprite(spritenum).member = ondown
    updatestage
  end if
end
on mouseup
  if member(sprite(spritenum).member) = offdown then
    sprite(spritenum).member = onroll
    updatestage
  end if
  if member(sprite(spritenum).member) = ondown then
    sprite(spritenum).member = offroll
    updatestage
  end if
end
------ Events ------  

 


Contact

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

Send e-mail