Learning to crawl
January 10, 1999
by Pat McClellan
Dear Multimedia Handyman,
I am creating a multimedia resume and would like to place a crawling marquee across the bottom of my Director Movie. So far, I don't have a clue how to go about this.
Terry Bredemeyer
Terry,
This is pretty easy to do. The concept is that you'll have a display field that is a set number of characters (chars) wide. For this example, let's say that it is 26 chars. As the message string crawls across the display, what we'll be doing is deleting the first char in the string (as it disappears on the left side of the display) and adding a char at the end. This way, char 2 becomes char 1, char 3 becomes char 2, etc.
I'll write this as a movie script with several handlers, which you can call from any other script simply by naming the handler and supplying it with the message string and the number of chars to display at a time. You will call the handler with the following format:
crawlMessage (messageString, chars)
Since the message will repeat itself, I recommend adding some spaces at the end of your message string so that there is some separation before the repeat. Also, the handler assumes that you have a field member named "display".
I'm going to use a global variable called gcrawlFlag as a "flag". This is simply a signal that says "time to crawl" or "time to stop". By using a global variable flag, I'll be able to have an exitFrame handler check that flag on every frame exit. If the flag says #crawl, then the crawling code will execute. Note that exitFrame handlers are usually frame scripts, but I'm putting this one in a movie script. That means that it will execute -- or at least check on the crawl flag -- on the exit of every frame in the movie.
message crawler movie script
on crawlMessage messageString, chars
global gcrawlFlag, gLoop
set gLoop = the number of chars in messageString ¬
+ 1
set gcrawlFlag to #crawl
initMessage messageString, chars
end
on stopcrawl
global gcrawlFlag
set gcrawlFlag to #stop
end
on initMessage messageString, chars
global gMessage
set endChar = chars
set gMessage = messageString
put char 1 to endChar of gMessage into field ¬
"display"
end
on exitFrame
global gcrawlFlag, gMessage, gNextChar, gLoop
if gcrawlFlag = #crawl then
set gNextChar = gNextChar + 1
if gNextChar > gLoop then
set gNextChar = 0
end if
delete char 1 of field "display"
put char gNextChar of gMessage after field ¬
"display"
end if
end
When you're ready to stop the crawl, simply issue the command "stopCrawl". That will change the crawl flag to #stop. The exit frame script will see this and will stop changing the display. Since we're using an exitFrame script to generate the crawl, the tempo of your movie will determine the crawl speed.
Good luck with your project.
Copyright 1997-2025, Director Online. Article content copyright by respective authors.