feathersui / feathersui-starling

User interface components for Starling Framework and Adobe AIR
https://feathersui.com/learn/as3-starling/
Other
915 stars 386 forks source link

Overlay ScrollText with Starling #348

Closed AlBirdie closed 11 years ago

AlBirdie commented 11 years ago

Sitting on top of Starling, the flash display list based ScrollText is somehow limited in its usage and just won't do it for applications that can display controls over this text, such as a news reading app.

I'm wondering if there isn't a way to overcome this issue, maybe by taking a snapshot of the text once it has been displayed, dispose the Scrolltext and merely scroll the image. IIRC this is how the Flex UIComponent StageWebView component is done. You can check it out here: http://www.judahfrangipane.com/blog/2011/01/16/stagewebview-uicomponent/

Not sure if its applicable at all, but a ScrollText that can be used like a regular Starling component would be a very nice feature indeed!

joshtynjala commented 11 years ago

and merely scroll the image

ScrollText is for cases when you cannot scroll an image because it is larger than the 2048x2048 texture limit. If you can ensure that your texture can fit in 2048x2048 texture, you should be using TextFieldTextRenderer instead of ScrollText.

AlBirdie commented 11 years ago

Didn't even think about the limited texture size. Thanks for the heads up. So no chance for making ScrollText a little more user capable. Darn.

Naturally the 2048 pixels won't do it, especially not on an iPad. Wondering if the StageWebView approach would be a viable alternative.

joshtynjala commented 11 years ago

The only alternative I can see is taking bitmap/texture snapshots of the visible region of ScrollText. Then, as it scrolls, take another snapshot and replace the texture on the GPU. This will probably affect scrolling performance significantly.

AlBirdie commented 11 years ago

Yes, probably going to do something like like, even though taking a snapshot once the scrolling has finished should suffice, thus not affecting scrolling performance.

Thanks Josh!

AlBirdie commented 11 years ago

Josh, I came up with another idea and just wanted to ask you whether you think its feasible. Instead of using ScrollText at all, I thought about splitting the String in chunks and creating a regular TextFieldTextRenderers for each chunk. These Renderers would then be placed vertically in a Scroller.

Would that work or does the texture size limit apply to this workaround as well?

Also, in this thread (http://forum.starling-framework.org/topic/scrolling-over-a-long-text) Daniel mentions to simply use a bitmap font for very long texts (<8193 characters). Would that work with the BitmapFontTextRenderer?

joshtynjala commented 11 years ago

Yes, you could break up TextFieldTextRenderers into lines. That would work. Your new limitation would be the number of textures that may be created, but that should be a little harder to reach.

Also, yes, long passages of text can also be drawn with bitmap fonts.

AlBirdie commented 11 years ago

Good to know. Thanks again!