Actionscript 3 Designer Toolkit

More design, less programming

Actionscript 3 Designer Toolkit header image 2

Moving Text: Ticker Class

November 19th, 2009 · 7 Comments · AS3 Custom Classes

The Ticker Class is a news ticker with a variety of user specified settings. In addition to the text displayed, the color, size, regular/bold, background color and rate of movement are all customizable.

This class automatically calculates the dimensions of the clip determined by the font, font size, whether the font is regular or bold and the user specified horizontal and vertical padding. An additional yOffset parameter is provided so that the vertical placement of the text can be tweaked.

For those interested, the core of the ticker function is three separate clips of the specified text lined-up side by side with only the center clip visible due to its alignment with a mask on a layer above it. The three text clips are move to the left at the same rate. When the leftmost clip, reaches a calculated x position, it is moved back to the rightmost position. In this way, the three clips continue circulating from right to left indefinitely.

The fully commented class and sample .fla are included in the download below.

Download files: Ticker.zip (246)

If you found this post helpful please consider a Retweet. Thanks!

Post to Twitter

Tags: ··

7 Comments so far ↓

  • amul

    Fantastic work… please keep em coming!!

  • Chris

    Hey this is really awesome work, but I have a question, when I use a really long string, it seems the ticker gets longer as well.

    how do I make the ticker itself stay at say 200 width even if my string is say 500 width?

  • Charles Davis

    Chris,
    Unfortunately, the class was designed to automatically set the width of the textfield – ie ticker – by measuring the length set by the passed string and then adding the horizontal padding to both the right and left.

  • Mike

    Is there a cs3 version of this, I can’t open it.

  • Charles Davis

    Mike,
    The download is a CS3 version. I just downloaded the zip and was able to open both the .fla and .as file in Flash CS3/4. Try downloading again…

  • John

    wow, that’s most complex way to do such simple thing i’ve ever saw in as3. i’m just a newbie in as3, but all i want to do is moving text from right to left in fixed text field. can this be so complex ? if anyone can point, i would be gratefull.

  • Charles Davis

    I will post a short tutorial tomorrow, Thursday March 11, on using caurina to tween text as simply as possible.

Leave a Comment

Spam Protection by WP-SpamFree