Articles Archive
Articles Search
Director Wiki

Movie Credit Scroller

February 28, 1999
by Pat McClellan

Dear Multimedia Handyman,

Is there a way to have a field scroll like credits you would see at the end of a movie? Any pointers would be helpful. Thanks in advance.

Jim Kelton

Dear Jim

This is a pretty easy thing to do, either with a field or text member. The way you do this is my continually resetting "the scrollTop of member" for your text/field member. What you need to do is create your text member and set the cast member properties to "Cropped". Then place the cast member on stage, adjusting the top and bottom of it so that it cuts off the text at the point you want. Here's a demo, which can also be downloaded. (Mac or PC)

Now, let's create the behavior that is dropped on the text member. To assure that the behavior will be useful for other applications in the future, we'll add a couple of properties to give you authoring options. The first option is speed. This number will be the number of pixels per frame that the text will scroll up. The higher the number, the faster the scroll. I'll default this property to 2 pixels/frame.

The second property is a simple flag that tells us whether the credits should start scrolling automatically (on beginSprite). If the box is not checked, the behavior will wait for a Lingo call to start the scroll. I'll also provide for that Lingo call to change the speed of the scroll if needed.

-- CreditScroll Behavior
-- apply to field or text member
property pSpeed, pFlag, pMyMember
on getPropertyDescriptionList me
  set pdlist to [:]
  addprop pdlist, #pSpeed, [#comment:"Speed (pix/frame)", ¬
    #format:#integer, #default:2]
  addprop pdlist, #pFlag, [#comment:"Start on beginSprite?", ¬
    #format:#boolean, #default:0]
  return pdlist
end getPropertyDescriptionList
on beginSprite me
  set pMyMember = the member of sprite the spriteNum of me    
on exitFrame me
  if pFlag then
    set currentTop = the scrollTop of member pMyMember
    set newTop = currentTop + pSpeed
    set the scrolltop of member pMyMember = newTop
  end if
on startScroll me, speed
  set pSpeed = speed
  set pFlag = 1
on stopScroll me
  set pFlag = 0

Really, there's not much to the actual behavior. The exitFrame handler simply checks to see if the pFlag property is TRUE, and if so, it resets the scrollTop of the member to a higher number, incremented by the number of pixels specified in pSpeed. The only other handlers are startScroll and stopScroll. The point of these handlers is evident. They simply turn the scrolling on or off by resetting the pFlag to 1 or 0.

If you want to have the scroll start offscreen (rolling up from below the stage) just add some blank lines at the top of your text member. Good luck with your program.

Patrick McClellan is Director Online's co-founder. Pat is Vice President, Managing Director for Jack Morton Worldwide, a global experiential marketing company. He is responsible for the San Francisco office, which helps major technology clients to develop marketing communications programs to reach enterprise and consumer audiences.

Copyright 1997-2019, Director Online. Article content copyright by respective authors.