开发者

Actionscript 3, read file text at compile time?

There is some way to make the flash put the content of one text file in a string, or at least put it in the .swf,开发者_开发技巧 so the user don't need to download it?


Solution:

[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 understand how to read the data from the Byte Array.


I've always used a pre-compile step to populate a template. It's pretty easy to make a class that has a string to be populated before compilation.

Ant can do this pretty easily. Check out the replace task.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜