|
-
Senior Member
Importing binary files in a Flash CS3 project ?
Hi,
I know that Flex can import binary files, but it seems a pure Flash project can't do this.
I thought that we could write a little utiliy in whatever scripting language that would turn a binary file into a .as class in this kind :
Code:
var binary:ByteArray=new ByteArray();
var myData:Array=[0x34,0x56,0xF1 etc....... ];
for (var i:int=0;i<myData.length;i++) {
binary.writeByte(myData[i]);
}
What do you think ?
-
Code:
public class test extends Sprite {
[Embed(source=”anybinaryfile.bin”, mimeType=”application/octet-stream”)]
private const binaryFile:Class;
public function test() {
var ba:ByteArray = new binaryFile() as ByteArray;
}
}
Or did you mean import from an external location? (i.e. while the SWF is running)
-
Senior Member
Thx, I mean import before compilation, not at runtime.
Can you confirm this code is Flex only and not CS3 ?
[Embed(source=”anybinaryfile.bin”, mimeType=”application/octet-stream”)]
-
Sorry yes, Embed is flex2 only, not CS3 - should have read your first post more carefully
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|