Here is an example:
public class EmbedText extends Sprite { [Embed(source="textfile.txt",mimeType="application/octet-stream")] var myText:Class; public function EmbedText () { var txt:ByteArray = new myText() as ByteArray; trace(txt.toString()); } }
This will include the file 'textfile.txt' in your SWF at compile time. If you want to download a text file from the server at runtime, you must use the URLLoader class.
source share