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 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