1 person found this helpful
You need to use the new load() method of FileReference to load the file locally within the player. This method is only available in Flash Player 10. Previous players do not allow local loading of files, forcing developers to upload the file directly to the server and then download it for subsequent processing.
If you must support FP9 and ealier then you will need to use the upload() method of FileReference to upload the file directly to the server, and then subsequently download it for any client-side processing that may be required.
If you are happy going with an FP10-only solution and you are using Flex 3.2 or later, then you will need to modify your build to use the new FP10 features. You do this by going to Project Properties -> Flex Compiler in Flex Builder and modifying the Require Flash Player version to 10.0.0.
Save these properties and do a clean build.
With these settings the following demo application will build and run:
<?xml version="1.0" encoding="utf-8"?>
private var fileReference : FileReference;
private var loader : Loader;
private function onLoad() : void
var fileFilter : FileFilter = new FileFilter( "Image", "*.jpg" );
fileReference = new FileReference();
fileReference.browse( [ fileFilter ] );
fileReference.addEventListener( Event.SELECT, onSelect ) ;
private function onSelect( event : Event ) : void
fileReference.addEventListener( Event.COMPLETE, onLoaded );
private function onLoaded( event : Event ) : void
bitmapImage.source = fileReference.data;
Thank you for the explanation and sample code.
My problem is that I'm running on an older Mac with a PowerPC processor, and I'm not sure if I can get FP10 debugger to function on my system.
I can't upload then process. Part of the reason I am trying to do this is that my server provider has a very low timeout cap on uploads, so I need to reduce the filesize prior to uploading.
Sorry to hijack, but hey Adobe! FileReferenceList does not fire the complete event against fileList fileReferences in Air 1.5, fp 10.0.0. This has been a reported bug which has been closed, submitted, closed and closed again and again. This will likely cost us about $30,000 because you refuse to acknowledge this is a real bug. Pls fix!!!!!!!!!!!!!!!!