Arrays

Get Adobe Flash player

Start a new ActionScript3 movie and save it as message.fla.

  1. Select the text tool and write good job in the text.
  2. Make it dynamic text and name the instance lblMessage.
  3. Make the text box big enough to hold other messages, not just "Good Work."
  4. Make sure that the text is left justified.
message

We will start with code to make the words scroll across the stage from right to left and reenter on the right.

lblMessage.x=stage.stageWidth; //put the message off on the right
addEventListener(Event.ENTER_FRAME,frames);

function frames(e:Event):void {
  lblMessage.x--;
  if(lblMessage.x<0-lblMessage.width) {
    lblMessage.x=stage.stageWidth; //put the message off on the right
  }
}
Download the flash file

NEXT: Message Changes