class flixel.addons.plugin.FlxScrollingText extends FlxPlugin

Available on all platforms

FlxScrollingText * -- Part of the Flixel Power Tools set * * v1.0 First version released * * @version 1.0 - May 5th 2011 * @link http://www.photonstorm.com * @author Richard Davey / Photon Storm * @co-author Ungar Djordje / ArtBIT (HaXe port)

Class Fields

static function add(bitmapFont:FlxBitmapFont, region:Rectangle, ?pixels:Int = 1, ?steps:Int = 0, ?text:String = 'FLIXEL ROCKS!', ?onlyScrollOnscreen:Bool = true, ?loopOnWrap:Bool = true):FlxSprite

Adds an FlxBitmapFont to the Scrolling Text Manager and returns an FlxSprite which contains the text scroller in it. * The FlxSprite will automatically update itself via this plugin, but can be treated as a normal FlxSprite in all other regards * re: positioning, collision, rotation, etc. * *

bitmapFont

A pre-prepared FlxBitmapFont object (see the Test Suite examples for details on how this works) *

region

A Rectangle that defines the size of the scrolling FlxSprite. The sprite will be placed at region.x/y and be region.width/height in size. *

pixels

The number of pixels to scroll per step. For a smooth (but slow) scroll use low values. Keep the value proportional to the font width, so if the font width is 16 use a value like 1, 2, 4 or 8. *

steps

How many steps should pass before the text is next scrolled? Default 0 means every step we scroll. Higher values slow things down. *

text

The default text for your scrolling message. Can be changed in real-time via the addText method. *

onlyScrollOnscreen

Only update the text scroller when this FlxSprite is visible on-screen? Default true. *

loopOnWrap

When the scroller reaches the end of the given "text" should it wrap to the start? Default true. If false it will clear the screen then set itself to not update. * *

returns

An FlxSprite of size region.width/height, positioned at region.x/y, that auto-updates its contents while this plugin runs

static function addText(source:FlxSprite, text:String, ?overwrite:Bool = false):Void

Adds or replaces the text in the given Text Scroller. * Can be called while the scroller is still active. * *

source

The FlxSprite Text Scroller you wish to update (must have been added to FlxScrollingText via a call to add() *

text

The text to add or update to the Scroller *

overwrite

If true the given text will fully replace the previous scroller text. If false it will be appended to the end (default)

static function clear():Void

Removes all FlxSprites * This is called automatically if the plugin is destroyed, but should be called manually by you if you change States * as all the FlxSprites will be destroyed by Flixel otherwise

static function isScrolling(source:FlxSprite):Bool

Checks to see if the given FlxSprite is a Scrolling Text, and is actively scrolling or not * Note: If the text is set to only scroll when on-screen, but if off-screen when this is called, it will still return true. * *

source

The FlxSprite to check for scrolling on. *

returns

Bool true is the FlxSprite was found and is scrolling, otherwise false

static function remove(source:FlxSprite):Bool

Removes an FlxSprite from the Text Scroller. Note that it doesn't restore the sprite bitmapData. * *

source

The FlxSprite to remove scrolling for. *

returns

Bool true if the FlxSprite was removed, otherwise false.

static function startScrolling(?source:FlxSprite = null):Void

Starts scrolling on the given FlxSprite. If no FlxSprite is given it starts scrolling on all FlxSprites currently added. * Scrolling is enabled by default, but this can be used to re-start it if you have stopped it via stopScrolling. * *

source

The FlxSprite to start scrolling on. If left as null it will start scrolling on all sprites.

static function stopScrolling(?source:FlxSprite = null):Void

Stops scrolling on the given FlxSprite. If no FlxSprite is given it stops scrolling on all FlxSprites currently added. * Scrolling is enabled by default, but this can be used to stop it. * *

source

The FlxSprite to stop scrolling on. If left as null it will stop scrolling on all sprites.

Instance Fields

function new():Void

function destroy():Void

function draw():Void