6 Replies Latest reply: Jul 11, 2012 3:38 AM by Bruce_Jawn RSS

    how to read with supplyFile()?

    DavidKomer Community Member

      Short version:

      I see there is an alchemy method called supplyFile(), but the second arg is a ByteArray... what in the world is that for?!?!

      Longer version:

      I would like to do the following:

      1. Open a file and assign it to a global variable on the C side of alchemy.
      2. Read in (and process) a chunk of bytes on the C side
      3. Send them to Actionscript for display
      4. Go to step 2 until EOF or notification from Actionscript
      5. Close the file

      I'm able to do this right now by opening the file and reading the chunks into a ByteArray on the Actionscript side and then passing it to C for processing and back- but this calls some unnecessary overhead by needing to do AS3_ByteArray_writeBytes()/AS3_ByteArray_readBytes() on the C side in order to manipulate the data in a char *.

      Is there any way to simply fopen() a file on the C side and read in some bytes? If not, will this be possible in alchemy 2?

      Asssume we are talking about a very large file on disk (>4GB).