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
Wait for a Keypress
Orbital Master
DirectSound Xtra
3D Rotation
Amplitude Xtra Review
De-Xplode that text random
RGB to HSV, HSV to RGB
Windows and Cascading Menus for Shockwave
Anatomy of an Alpha Channel
PDF Class
 

 

 

Behavior Sliding menu

Added on 4/21/2000

 

Compatibilities:
behavior D7 D8 Mac PC Shockwave

This item has not yet been rated

Author: BrentMoseley

A menu that slides out from the left or right on mouseenter. Just drop onto a sprite and fill in the blanks. All the properties should be pretty straight forward.

Download PC Source    Download Mac Source
--Side scrolling menu.
--Created by Brent Moseley.  April, 2000
--brent099@xoommail.com

property mysprite     -- current sprite number
property othersprite  -- Additional sprite to "attach" to current sprite.
property destloc      -- location sprite should stop at
property startloc     -- location sprite begins and returns to
property speed        -- speed at which the sprite moves to and from destination
property mo           -- 1 if mouse is over sprite, 0 if not
property myframe      -- frame to go to when the sprite is pressed
property myoffset     -- horizontal offset of othersprite
property newmember    -- member to change to on mousedown
property oldmember    -- member to change to on mouseup

on beginsprite me
  mysprite = the spritenum of me
  oldmember = the member of sprite mysprite
  
  if startloc = 0 then
    startloc = the loc of sprite mysprite
  else
    the loch of sprite mysprite = startloc
  end if
end

on mouseenter me
  mo = 1
end

on mouseleave me
  mo = 0
  the member of sprite mysprite = oldmember
end


on mousedown me
  if myframe = 0 then
    return
  end if
  the member of sprite mysprite = newmember
end


on mouseup me
  if myframe = 0 then
    return
  end if
  the member of sprite mysprite = oldmember
  go to frame myframe
end



on prepareframe me
  if mo = 1 then --if the mouse is over
    if the loch of sprite mysprite < destloc and speed > 0 then --if it"s moving left
      the loch of sprite mysprite = the loch of sprite mysprite + speed
    end if
    
    if the loch of sprite mysprite > destloc and speed < 0 then --if it"s moving right
      the loch of sprite mysprite = the loch of sprite mysprite + speed
    end if
    
  else --if the mouse is not over
    
    if the loch of sprite mysprite > startloc and speed > 0 then -- if it"s moving right
      the loch of sprite mysprite = the loch of sprite mysprite - speed
    end if
    
    if the loch of sprite mysprite < startloc and speed < 0 then -- if it"s moving left
      the loch of sprite mysprite = the loch of sprite mysprite - speed
    end if
  end if
  
  
  the loch of sprite othersprite = the loch of sprite mysprite + myoffset
end



on getPropertyDescriptionList
  set description = [:]
  
  addProp description,#startloc, ¬
    [#default:-50, #format:#integer, #comment:"Sprite"s horizontal origin. (0 for current loc)"]
  
  addProp description,#destloc, ¬
    [#default:50, #format:#integer, #comment:"Sprite"s horizontal destination."]
  
  addProp description,#speed, ¬
    [#default:4, #format:#integer, #comment:"How fast the sprite should move to and from it"s destination."]
  
  addProp description,#myframe, ¬
    [#default:0, #format:#frame, #comment:"Frame to go to when pressed (number or marker)"]
  
  addProp description,#othersprite, ¬
    [#default:0, #format:#sprite, #comment:"Sprite number of additional sprite to attach to current sprite."]
  
  addProp description,#myoffset, ¬
    [#default:0, #format:#integer, #comment:"Horizontal offset of additional sprite."]
  
  addProp description,#newmember, ¬
    [#default:0, #format:#member, #comment:"mousedown"]
  
  return description
end


on getBehaviorDescription
  return "Side scrolling menu." & return & return & ¬
  "Drop onto a sprite and fill in the blanks." & return & ¬
  "All the properties should be pretty straight forward." & return & return & ¬
  "Created by Brent Moseley.  April, 2000" & return & "brent099@xoommail.com"
end

 


Contact

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

Send e-mail