Nuclear Rooster

25Jul/080

Flex 3 Embed an external text file at compile time

Want to extract a string into an external file and still load it at compile time?
[actionscript]

[Embed(source="../resources/text.txt", mimeType="application/octet-stream")]
var myExternalTextFile:Class;
var tmpByteArray:ByteArray = new myExternalTextFile() as ByteArray;
var myText:String = tmpByteArray.toString();

[/actionscript]