Have you ever come across the situation where you just want to quickly put together a Flex-based interface with some text inside but don't have a backend system in place yet? I certainly have. What I did to make my life easier is simply create an ExternalText class that extends mx.controls.Text. It allows you to set a source attribute that points to the raw text you want to show and has an optional property called html to have it render as HTML or plain text.

You're now able to easily test and layout your interface locally and when you're ready to connect it up to some server side code its just a matter of changing the source attribute.

You can of course also hook up your navigation to simply update the source property of the ExternalText control and you've pretty much got yourself a functional application.

[flash]http://www.peterelst.com/blog/wp-content/uploads/2007/10/externaltext.swf,470,255[/flash]

I found this a rather nice little time saver for prototyping with Flex so wanted to share it with you all. Enjoy!

Download source code

Posted
AuthorPeter
CategoriesFlex