I have a block of html text which is displayed to the user in a TextArea. Currently, the I have embedded the HTML as an XML object within one of my classes, but this seems like a terrible design. I would like to put the HTML in an embedded file and load it into an XML or String object.
I've tried to search for how to do this, but my searches return information on embedding images and fonts, not text which can be loaded into Strings.
Is it possible to embedded text or xml files and load them into variables in Flex?
You can embed a text file with the following:
[Embed(source="myFile.txt",mimeType="application/octet-stream")]
private var myFile:Class;
It's important to note that this is embedded as a ByteArray, so you will need to read it out. Something like the following:
var b:ByteArray = new myFile();
var s:String = b.readUTFBytes(b.length)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With