Question

I am using flash builder 4.7. I tried to embed a json file while I got an error says:"../strings.json is of an unknown file type which can't be embedded".

Here is my code. [Embed(source="../media/data/strings.json"), mimeType="application/octet-stream"] public static const JsonData:Class;

I have no idea how to fix it.

I am using AIR SDK 3.4

I want to use embedded method since it's always annoying to access local resource (the global flash setting).

Was it helpful?

Solution

I checked the syntax you posted for embedding json file is incorrect. Please make it correct, it should be like

[Embed(source="a.json", mimeType="application/octet-stream")] public var jsonData:Class;

Then you can access json data like this:-

var str:String = new String(new jsonData()); var obj:Object = JSON.parse(str);

Please make sure your a.json file must have a valid json data.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top