I've been trying to set up a scrolling text field for some time now and finally managed to do it by rendering it off screen and using a separate FlxCamera to render it in place, then scrolling the FlxCamera.
But I now realize that this is going to prevent anything from every being layered on the camera, if I had know that then I could of just used an openfl.text.TextField directly. How would I go about layering the FlxCamera within the states members? Looking at it, it looks like I might be able to use copyPixels or drawPixels to draw them onto an FlxSprite. Is that a reasonable thing to attempt? I'm worried about significant performance issues if I go down that route.
This if for the Flash target if that's relevant.
What do you mean by
this is going to prevent anything from every being layered on the camera
Anyway, have you set
camerasvariable? If not, try this:
FlxCamera.defaultCameras = [FlxG.camera]; scrollingText.cameras = [scrollingCamera]; \\ that scrolling camera you mentioned
The actual text field is far off-screen, I've set up a second camera with a transparent background focused on it, but with its viewport on-screen so I can scroll the camera and give the appearance of a scrolling text field. More specifically, I'm using this implementation of scrolling areas.
The problem is now can't render sprites on top of the text because cameras are seemingly on top of all other objects.
Basically when I open some kind of menu it's displayed behind the scrolling text field, I guess I could offset the menu off-screen so it appeared on the scrolling text camera, but that's a pretty big change.
There's a more simple approach without using camera! Just changing the position of the text. Although you may need to keep track of the scrolling by adding a variable.
But there's too much text to be displayed in the field alone, you have to scroll to reveal more text.
I've been trying to do this for months and made several post on the forums and on Github, there's no way to limit the amount of text visible in an FlxText field, not without extending it and changing it massively.
You can try to make a FlxText which removes the first line when it's off-screen and gradually adds new lines instead of showing all of them at once.
Also show a piece of code or images of the problem you're facing. It's kinda hard for me to make it out of texts.