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
PowerPoint / PPT Access
Stock quote
Firefly CD Burning Xtra
cXtraRTFEditor
Move sprite along mouse vector Behavior
Lissajous Motion
SecureNet Xtra
Drag sprite around a snap grid
Setup Anim
Scroll Sprite by MouseLoc Behavior
 

 

 

Behavior Animated Button

Added on 7/4/1999

 

Compatibilities:
behavior D7 D8 Mac PC Shockwave

Rating:

Author: MediaMacros (website)

Allows for an animated button (mouseEnter triggers a foward animation, mouseLeave triggers a reverse animation.) Allows multiple buttons to be moving at once.

--Copyright 1999 Chuck Neal
--chuck@mediamacros.com
--If you find this code helpful, send me an e-mail and let me know.  :-)

property prefix, startMember, endMember, spriteNum, currentNum, state

on getPropertyDescriptionList me
  p_list = [:]
  addProp p_list, #prefix, [#format : #string, #default : "button", #comment : "Prefix for graphic names:"]
  addProp p_list, #startMember, [#format : #integer, #default : 0, #range : [#min : 0, #max : 25], #comment : "Start frame number:"]
  addProp p_list, #endMember, [#format : #integer, #default : 0, #range : [#min : 0, #max : 25], #comment : "End frame number:"]
  return p_list
end

on beginSprite me
  currentNum = startMember
  state = 0  
end


on endSprite me
  (the actorlist).deleteOne(me)
end

on mouseEnter me
  --add to the actorList if not already there
  if getOne(the actorList, me) = 0 then add the actorList, me
  state = 1 --Go up
end

on mouseLeave me
  state = 2 --Go down
end

on stepFrame me
  case state of
    0, 3 :
      nothing
    1 :
      --go up
      currentNum = currentNum + 1  
      if currentNum > endMember then currentNum = endMember
      sprite(spriteNum).member = prefix & string(currentNum)
    2 :
      --go down
      currentNum = currentNum - 1
      if currentNum < startMember then currentNum = startMember
      sprite(spriteNum).member = prefix & string(currentNum)
      --check to see if the item is done
      if currentNum = startMember and the rollover <> spriteNum then
        --remove from the actorList on next stepFrame
        state = 3
      end if
  end case
end

on exitFrame me
  if state = 3 then
    deleteOne the actorList, me
    state = 0
  end if
end

on getBehaviorDescription me
  return "This behavior will animate a button using numbered cast members with a set prefix when the mouse rolls over it and moves back off.  It is important to not skip any frames and that no extra zeros are used in the names. (I.E. do not use 001, use 1)."
end

 


Contact

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

Send e-mail