on getBehaviorDescription me
return \
"[EASY]" & RETURN & RETURN & \
"Use this behavior to make a nice scroll effect around a text. " & \
"Drag this behavior onto any sprite with a text or field member. " & \
"You can write something in the member, the initial value will be restored on endsprite."
end getBehaviorDescription
on getBehaviorTooltip me
return \
"[EASY] Use this behavior to make a nice scroll effect around a text. " & \
"Drag this behavior onto any sprite with a text or field member. " & \
"You can write something in the member, the initial value will be restored on endsprite."
end getBehaviorTooltip
on beginsprite me
my = sprite(me.spritenum).member
oldText = my.text
-- fill in member with text
repeat with i = 1 to lengthLeft
tempLeft = tempLeft & textDisplay.char[random(textDisplay.length)]
end repeat
repeat with i = 1 to lengthRight
tempRight = tempRight & textDisplay.char[random(textDisplay.length)]
end repeat
my.text = charLeft & tempLeft & textDisplay & tempRight & charRight
if textDisplay = "" then textDisplay = oldText
pntLeft = 1
pntRight = 1
pntTimerLeft = the milliseconds + timerLeft
pntTimerRight = the milliseconds + timerRight
end
on endsprite me
my.text = oldText
end
on newtext me
if the milliseconds > pntTimerLeft then
tempLeft = my.text.char[2+charLeft.length..lengthLeft+charLeft.length] \
& sequenceLeft.char[pntLeft]
if pntLeft < sequenceLeft.length then
pntLeft = pntLeft + 1
else
pntLeft = 1
end if
pntTimerLeft = the milliseconds + timerLeft
end if
if the milliseconds > pntTimerRight then
tempRight = my.text.char[my.text.length-(lengthRight-2+charRight.length)..my.text.length-(lengthRight-lengthRight+charRight.length)] \
& sequenceRight.char[pntRight]
if pntRight < sequenceRight.length then
pntRight = pntRight + 1
else
pntRight = 1
end if
pntTimerRight = the milliseconds + timerRight
end if