6 Replies Latest reply on Apr 20, 2010 12:26 PM by kfcdoubledown

    Issue with FileReference.load() on Mac/Firefox 3.6/FlashPlayer


      Hey there,


      After several days of banging my head against my desk trying to figure out what my application is doing wrong, I think I stumbled across a problem that either I'm not handling correctly in my code or that is a bug in the Flash Player plugin for Firefox on the Mac (and on Linux).


      Here are my specs:

      MacBook Pro with Snow Leopard 10.6.3

      Firefox 3.6.3 w/ Flash Plugin

      Safari 4.0.5 w/ Flash Plugin

      FlashBuilder 4.0 (272416)

      Flex 3.5 SDK


      I can't post the code I've been working on as it's for a work project; however, I found something on Adobe's site that manifests this problem:




      If you open up this page in Firefox 3.6 on the Mac, you may notice that the crop box doesn't work properly (or at least I noticed this behavior).  What I would see is that the crop box would immediately fill to the lower right hand corner.


      Open up the same link in Safari and it works properly.


      The following is what I've noticed in my debugging efforts on my own application:

      • After completing a FileReference.load call, the Flash application appears to lose focus (perhaps to the operating system?)
      • Moving the cursor (both in my case and I think in the example on the site) results in getting undefined (and astronomical) values back when you poll for the mouse cursor's position.
      • Clicking outside of Firefox and clicking back in seems to resolve this.  It seems like leaving the window and returning solves the problem.


      To provide another example of this behavior, I've altered some code that does a similar function to the example on Adobe's site to produce some statistics about where the mouse cursor is:


      The code example:

      http://blog.flexexamples.com/2008/08/25/previewing-an-image-before-uploading-it-using-the- filereference-class-in-flash-player-10/#more-766


      My code (my changes are bolded):

      <?xml version="1.0" encoding="utf-8"?>
      <!-- http://blog.flexexamples.com/2008/08/25/previewing-an-image-before-uploading-it-using-the- filereference-class-in-flash-player-10/ -->
      <s:Application name="FileReference_load_test"
                     xmlns:net="flash.net.*" xmlns:mx1="library://ns.adobe.com/flex/mx"
            import mx.controls.Alert;
            import mx.utils.ObjectUtil;
            private var appX:Number;
            private var appY:Number;
            private function init():void {
              addEventListener(MouseEvent.MOUSE_MOVE, handleMove);
            private function handleMove(event:MouseEvent):void {
              appX = event.localX;
              appY = event.localY;

            private function btn_click(evt:MouseEvent):void {
              var arr:Array = [];
              arr.push(new FileFilter("Images", ".gif;*.jpeg;*.jpg;*.png"));
            private function fileReference_select(evt:Event):void {
            private function fileReference_complete(evt:Event):void {
              img.source = fileReference.data;
          <net:FileReference id="fileReference"
                             complete="fileReference_complete(event);" />
        <s:Panel id="panel"
            <s:VerticalLayout />
          <mx1:Image id="img"
                    maxHeight="200" />
            <s:Button id="btn"
                       label="Browse and preview..."
                       click="btn_click(event);" />
            <s:Button label="Upload..."
                       enabled="false" />
            <s:Label text="MouseX:" />
            <mx1:Text text="{appX}" />
            <s:Label text="MouseY:" />
            <mx1:Text text="{appY}" />



      If you compile and run this application in Firefox, you should see that the X and Y values for the mouse stop updating after the file is loaded.  On Safari they continue to update.


      I couldn't find any reference to this problem searching on Google (perhaps not the right keywords?).


      Anyone have any input on this issue?  Any help is appreciated