on getPropertyDescriptionList me
description = [:]
addProp description,#pTextStr, [#default:"message", #format:#string, #comment:"The message to be shown..."]
addProp description,#pDelayTime, [#default:25, #format:#integer, #comment:"The delay a next char will appear."]
addProp description,#pRepeat, [#default:FALSE, #format:#boolean, #comment:"Repeat."]
addProp description,#pReverse, [#default:FALSE, #format:#boolean, #comment:"Reverse."]
return description
end
on getBehaviorDescription me
return "Char Scrollie within a text or field member." & RETURN
& "You can send an event to mEvent handler for a repeat by event call." & RETURN
& "For example : sendSprite(10, #mEvent) or sendAllSprites(#mEvent) statements." & RETURN
& "(C) 2003 by BaZ"
end
on beginSprite me
-- Init vars
pSprite = me.spriteNum
pMem = sprite(pSprite).member
member(pMem).wordWrap = TRUE
-- Init time
pLastTime = 0
me.mReset()
end
on mReset me
-- Prepare text box if reverse make spaces
member(pMem).text = ""
pTotalChar = pTextStr.char.count
-- If reverse put spaces into it
if pReverse then
repeat with tNumChars = 1 to pTotalChar
member(pMem).text = member(pMem).text & " "
end repeat
end if
-- Prepare to be shown message
pCurrentChar = 1
pTickerState = #notDone
end
-- Call this handler if you want to repeat the effect when an event takes place.
-- sendSprite(x, #mEvent) of sendAllSprites(#mEvent)
on mEvent me
-- If busy then nothing
if not(pTickerState = #done) then exit
-- Otherwise do a repeat accoring to event...
me.mReset()
end
on exitFrame me
if not(pTickerState = #done) then
if not(the ticks < pLastTime + pDelayTime) then
-- It' time to show a new char
-- Check reverse
if not(pReverse) then
tNewChar = (pTextStr).char[pCurrentChar..pCurrentChar]
member(pMem).text = member(pMem).text & tNewChar
else
tNewChar = (pTextStr).char[pCurrentChar..pCurrentChar]
-- Erase a space and replace it with a char unless if it's the last char to be used
if not(pTotalChar = pCurrentChar) then
delete member(pMem).char[(pTotalChar - pCurrentChar)]
end if
member(pMem).text = member(pMem).text & tNewChar
end if
if pCurrentChar = pTotalChar then
pTickerState = #done
else
pCurrentChar = pCurrentChar + 1
end if
-- Record time for next update
pLastTime = the ticks
end if
else
-- If done check for repeat the thing...
if pRepeat then
-- Gotta reset my stuff
me.mReset()
end if
end if
end
Contact
MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA