0 Replies Latest reply on Jan 3, 2010 12:21 PM by supo47

    DeepCopy of FileReference or alternatives





      in my project, I let users pick pictures using the FileReference class. I then load these pictures into their .data properties, using the load() function. After this I perform some local manipulation and send them to the server.



      What I would like to do, is to be able to iterate over the picked FileReferences again, load them into .data properties, perform different manipulation and send them to the server once again. I know that I should be able to do this from user-invoked event, that is not an issue here.



      Problem is, once the FileReference is loaded for the first time, I can not unload it in any way, and I can not keep the data for all the pictures in the memory because these are huge.



      So I guess there is only one thing I can do, which is performing a DeepCopy on the FileReference... Then I could load the first version, scrap it and use the copy for the second 'run'.



      I tried to use ObjectUtil.copy, but when I access e.g. .name property of the copy, it fails with:



      Error #2037: Functions called in incorrect sequence, or earlier call was unsuccessful.

      at flash.net::FileReference/get name()



      the relevant snippet:






      Is it true that there are some protected properties of FileReference class that prevent it from being copied? If it is so, can I sidestep this somehow? Or is there any other solution to my overall problem?



      I appreciate any hints/ideas!