property pStartNum -- INTEGER: starting cast member number for flipbook animation property pEndNum -- INTEGER: ending cast member number for flipbook animation property pStepSize -- INTEGER: how quickly flipbook images are advanced per frame property pLooped -- BOOLEAN: flipbook animation playback is looped property pPalindrome -- BOOLEAN: flipbook animation playback plays forward, then backward property pFrameNum -- INTEGER: counter for flipbook property pPlayDirection -- SYMBOL: #forward or #backward playback property pPlay -- BOOLEAN: flipbook is playing, TRUE or FALSE -- -- Attach this behavior to a sprite. -- Ken Loge - http//diginoodles.com -- on beginSprite me pPlayDirection = #forward end on getPropertyDescriptionList me list = [:] addProp list, #pStartNum, [#comment: "Starting cast member number:", #format: #integer, #default: 1] addProp list, #pEndNum, [#comment: "Ending cast member number:", #format: #integer, #default: 30] addProp list, #pPlay, [#comment: "Play on start:", #format: #boolean, #default: 1] addProp list, #pStepSize, [#comment: "Playback step speed:", #format: #integer, #default: 1, #range: [#min: 1, #max: 10]] addProp list, #pLooped, [#comment: "Looped playback:", #format: #boolean, #default: 1] addProp list, #pPalindrome, [#comment: "Palindrome playback:", #format: #boolean, #default: 0] return list end on exitFrame me if pPlay = TRUE then -- looped playback if pLooped = TRUE then loopedPlayback(me) end if -- palindrome playback if pPalindrome = TRUE then palindromePlayback(me) end if end if end on loopedPlayback me if pPlayDirection = #forward then pFrameNum = pFrameNum + pStepSize if pFrameNum > pEndNum then pFrameNum = pStartNum end if end if sprite(me.spriteNum).member = pFrameNum end on palindromePlayback me if pPlayDirection = #forward then pFrameNum = pFrameNum + pStepSize if pFrameNum > pEndNum then pFrameNum = pFrameNum - pStepSize pPlayDirection = #backward end if end if if pPlayDirection = #backward then pFrameNum = pFrameNum - pStepSize if pFrameNum < pStartNum then pFrameNum = pStartNum + pStepSize pPlayDirection = #forward end if end if sprite(me.spriteNum).member = pFrameNum end on togglePlayback me if pPlay = TRUE then pPlay = FALSE else pPlay = TRUE end if end on mouseUp me togglePlayback(me) end