开发者

Actionscript 3, read file text at compile time?

开发者 https://www.devze.com 2022-12-18 17:27 出处:网络
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:

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

精彩评论

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

关注公众号