I started getting more into Flash Builder/Flex 4 a few weeks ago, and all is going fine but I ran into what I believe is an odd situation: the File object being returned as the
event.target from a “browseForOpen” invocation is the same over different calls. This was throwing me off because I assumed that each time I called browseForOpen and selected a file, I would get a new File object. It’s nice from a memory management point of view to know there is re-use, but this doesn’t seem to me to be what should be expected.
Specifically, in my handler for the browseForOpen, I have the following line:
var f:File = (event.target as File);
The first time this handler is executed (on, let’s say, FileA), I store the “f” variable for later use. The second time this handler is executed, say for FileB, I store it in another data structure. Turns out, when I look at the object I stored the first go around, it has turned into FileB. I really would have expected a new File object to be created each time. Maybe I’m missing something basic?