FlxScrollingText -- Part of the Flixel Power Tools set -- Works only FLX_BLIT_RENDER mode for now
v1.0 First version released
@version 1.0 - May 5th 2011 @link http://www.photonstorm.com @co-author Ungar Djordje / ArtBIT (Haxe port)
Static methods
staticadd(bitmapText:FlxBitmapText, region:Rectangle, pixels:Int = 1, steps:Int = 0, ?text:String, onlyScrollOnscreen:Bool = true, loopOnWrap:Bool = true):FlxSprite
Adds an FlxBitmapTextField 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.
Parameters:
bitmapText | A pre-prepared FlxBitmapTextField 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
staticaddText(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.
Parameters:
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) |
staticclear():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
staticisScrolling(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.
Parameters:
source | The FlxSprite to check for scrolling on. |
---|
Returns:
True if the FlxSprite was found and is scrolling, otherwise false
staticremove(source:FlxSprite):Bool
Removes an FlxSprite from the Text Scroller. Note that it doesn't restore the sprite bitmapData.
Parameters:
source | The FlxSprite to remove scrolling for. |
---|
Returns:
True if the FlxSprite was removed, otherwise false.
staticstartScrolling(?source:FlxSprite):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.
Parameters:
source | The FlxSprite to start scrolling on. If left as null it will start scrolling on all sprites. |
---|
staticstopScrolling(?source:FlxSprite):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.
Parameters:
source | The FlxSprite to stop scrolling on. If left as null it will stop scrolling on all sprites. |
---|