我需要能夠將外部配置文件加載到我的Flex應用程序中。我讀過,只要將mimeType設置爲application/octet-stream,就可以使用嵌入。Actionscript 3中的外部配置文件
package learning {
import org.flixel.*;
public class PlayState extends FlxState {
[Embed(source = "../../data/tiles.png")] private var _tiles:Class;
[Embed(source = '../../data/map.txt', mimeType = "application/octet-stream")] private var ExternalMapData:Class;
public var txt:FlxText;
public var player:FlxSprite;
override public function create():void {
bgColor = 0xffaaaaaa;
super.create();
}
override public function update():void {
super.update();
}
}
}
當我編譯這個使用mxmlc
,它成功編譯沒有錯誤。當我運行SWF時,它加載所有的Flixel菜單然後掛起。
如果我註釋掉[Embed(source = '../../data/map.txt'
行,它會編譯並且不會掛起。
爲什麼這個嵌入導致凍結?
爲mxmlc的版本信息:
Adobe Flex Compiler (mxmlc)
Version 4.0.0 build 14159
編輯
原來沒有被正確顯示的錯誤,但是這是我從試圖嵌入越來越:
VerifyError: Error #1014: Class mx.core::ByteArrayAsset could not be found.
谷歌變成了一堆人有同樣的問題,但沒有appare nt解決方案。
import mx.core.ByteArrayAsset; ByteArrayAsset
也沒有幫助。
可能重複:HTTP://計算器。 com/questions/2187782/actionscript-3-read-file-at-compile-time – 2010-07-03 01:35:35
@ M28不重複 - 我有源代碼可以做我想做的事情,但它會導致程序因某種原因掛起。這篇文章首先提出瞭如何做到這一點。 – 2010-07-03 02:19:16
在給出的問題中:''../../ data/map.txt''和'../../ map.txt'',哪一個是正確的? – 2010-07-03 17:50:54