ActionScript 3, read file text at compile time?

Is there any way to get flash to put the contents of one text file into a string, or at least put it in .swf so that the user does not load it?

0
source share
2 answers

Decision:

[Embed(source = "ExampleText.txt", mimeType = "application/octet-stream")]
protected var pscene:Class;

var tmp:ByteArray = new pscene();
result = tmp.readMultiByte(tmp.bytesAvailable, tmp.endian);

It took me a while to figure out how to read data from an array of bytes.

+2
source

I have always used the pre-installation step to populate the template. It's pretty easy to create a class that needs to be populated before compilation.

Ant can do this quite easily. Check the replacetask .

+1
source

All Articles