Search code examples
apache-flexfilereference

FileReference.load() not populating FileReference.data


I am trying to use the load method of FileReference object to load the data and use it to display a thumbnail of the selected image.

However, after calling fr.load(), fr.data remains null.

I'm using Flex Builder 3.0.2 on Windows 7 with Flex SDK 3.4 and Flash Player 10 Debug. If I evaluate fr.load() in Eclipse's watch variables list, I get an error reading "No such variable: load."

Anyone know why this is happening?


Solution

  • Are you waiting for the load() to complete? Try adding an EventListener to listen for the load to be finished.

    FileReference docs

    fr.addEventListener(Event.COMPLETE, function(e:Event):void {
                                            handleLoad(e);
                                        });
    

    The handleLoad function that you write can then get at the data via e.target.data