0

I am coding an AIR application.

I've got directly a path of a swf file (because it was stored in a xml file). Do yo know if it is possible to get the ByteArray from this file ?

I know that FileReference do that very well, but this class need a select event. But it isn't my case because I've allready got my path.

Thanks a lot for your answers !

blackslam
  • 3
  • 2

2 Answers2

1

In AIR, you can read/write files directly using flash.filesystem.File and flash.filesystem.FileStream.

See, for example, this article.

Michael Brewer-Davis
  • 14,018
  • 5
  • 37
  • 49
  • 1
    Thank you for your answer! Here is my code: `var byteArray:ByteArray = new ByteArray(); var swfFile:File = File.applicationDirectory.resolvePath(fullSWFPath); var stream:FileStream = new FileStream(); stream.open(swfFile, FileMode.READ); **stream.readBytes(byteArray);** stream.close();` – blackslam Mar 20 '11 at 11:49
0

however you can load it with URLStream and get a ByteArray with URLStream.readBytes()

www0z0k
  • 4,444
  • 3
  • 27
  • 32