-- Sends a message string to a field one char at a time
------------------------------------------------------
property useString, myMessage, myAutoMode, myMessageField, myLength, myCurrentChar, myState, myDisplayField
-- useString : boolean flag for the source is a string (T) or a field (F)
-- myMessage : text of message to display
-- myAutoMode : flag for whether the message plays immediately or waits for keydown
-- myMessageField : name of cast member of source target (used only if useString = false
-- myLength : character length of the message
-- myCurrentChar : the charatcer that is currently being transmitted
-- myState : symbol flag for indicator of status
-- myDisplayField : cast member that is the target for display
------------------------------------------------------
on beginSprite me
-- load the message from the appropriate source
set myState = #pause
set myDisplayField = the name of the member of sprite (the spriteNum of me)
set the text of field myDisplayField = " "
if myAutoMode then typeIt
end
on typeItOnce me
if myState = #pause then typeIt
end
on typeIt me
if useString then
setMessage me, myMessage
else
setMessage me, the text of member myMessageField
end if
end
on prepareFrame me
if myState = #go then
set myCurrentChar = myCurrentChar + 1
if myCurrentChar > myLength then
set myState = #stop
else
set the text of member myDisplayField = char 1 to myCurrentChar of myMessage
end if
end if
end
on setMessage me, newMessage
-- sets up a message and intitiates its display
-- This can be called from another sprite (sendSprite...)
-- to send a different message at some other time
set myMessage = newMessage
set myLength = length( myMessage )
set myCurrentChar = 1
set the text of member myDisplayField = char 1 of myMessage
set myState = #go
end
on blitMessage me, newMessage
set myState = #stop
set the text of member myDisplayField = newMessage
end
on getBehaviorDescription
return "Plays back a stream of text to a field one char at a time. The source can be string entered in the Behavior dialog or from a field cast member."
end
Contact
MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA