FileReference ProgressEvent

Hi,
After scratching my head for months about a ProgressEvent issue I decided to post my problem.
I've been searching the web for a long time about my problem and all I could find was people with similar problems..
But none of them had a solution.
I've created a SWF file to upload files to the web server.
The even triggers the progressEvent.PROGRESS to let a javascript function know when the progress has changed.
When it's done uploading it triggers Event.COMPLETE.
When I test my code at first it doesn't seem to work.
The progress is event 2 or 3 times and then claims it's finished (While the Event.COMPLETE isn't fired yet).
When the file is actually uploaded flash triggers Event.COMPLETE accordingly.
So Event.COMPLETE is correct.. but ProgressEvent.PROGRESS is not.
At least, thats what I thought, when I tested it on another pc (With windows XP 64bit) it worked (Magically?)
I tried it on a Mac and it, again, worked...
I myself am using Windows 7 Professional 64 bit.
Could anyone guide me and tell me why it behaves like this?
Below is my code as it is right now.
package
     import flash.display.MovieClip;
     import flash.events.*;
     import flash.net.URLRequest;
     import flash.net.FileReference;
     import flash.net.FileReferenceList;
     import flash.external.ExternalInterface;
     import flash.geom.ColorTransform;
     import flash.system.Security;
     public class uploader extends MovieClip
          public var file:FileReferenceList;
          public var realList:Array = new Array();
          public function uploader()
               browseBtn.addEventListener(MouseEvent.CLICK, handleBrowse);
               ExternalInterface.addCallback("start", handleUpload);
          private function handleBrowse(e:MouseEvent):void
               ExternalInterface.call("uploader.report", "Step 1 - Getting files to upload");
               file = new FileReferenceList();
               file.addEventListener(Event.SELECT, handleSelect);
               file.browse();
          private function handleSelect(e:Event):void
               ExternalInterface.call("uploader.report", "Step 2 - Starting loop to add files");
               //ExternalInterface.call("uploader.refresh");
               for(var i:int = 0; i < file.fileList.length; i++)
                    ExternalInterface.call("uploader.report", "Step 2.1 - Adding files to realList");
                    realList.push(file.fileList[i]);
                    var name:String = file.fileList[i].name.toString();
                    ExternalInterface.call("uploader.report", "uploader.add(\"" + name + "\")");
                    ExternalInterface.call("uploader.add", name);
               ExternalInterface.call("uploader.done");
          private function handleUpload(t:String):void
               ExternalInterface.call("uploader.report", "Step 3 - Starting upload");
               /** Show that we are uploading **/
               var colorTransform:ColorTransform =  new ColorTransform();
               colorTransform.color = 0xff0000;
               browseBtn.transform.colorTransform = colorTransform;
               /** No files to be uploaded **/
               if(realList.length <= 0)
                    ExternalInterface.call("uploader.report", "Step 3 - No files found");
                    return;
               /** Create an url request **/
               var url:URLRequest = new URLRequest(t);
               /** Start uploading **/
               for(var i:int = 0; i < realList.length; i++)
                    realList[i].addEventListener(ProgressEvent.PROGRESS, handleProgress);
                    realList[i].addEventListener(Event.COMPLETE, handleComplete);
                    realList[i].upload(url);
                    ExternalInterface.call("uploader.report", "Step 3 - Uploading files");
          private function handleProgress(e:ProgressEvent):void
               ExternalInterface.call("uploader.report", "Step 3.P - Sending progress report:");
               ExternalInterface.call("uploader.report", e.currentTarget.name);
               ExternalInterface.call("uploader.report", e.bytesLoaded);
          private function handleComplete(e:Event):void
               ExternalInterface.call("uploader.report", "Step 3.P - Done uploading");

package
     import flash.display.MovieClip;
     import flash.events.*;
     import flash.net.URLRequest;
     import flash.net.FileReference;
     import flash.net.FileReferenceList;
     import flash.geom.ColorTransform;
     import flash.system.Security;
     public class uploader extends MovieClip
          public var file:FileReferenceList;
          public var realList:Array = new Array();
          public function uploader()
               browseBtn.addEventListener(MouseEvent.CLICK, handleBrowse);
               uploadBtn.addEventListener(MouseEvent.CLICK, handleUpload);
          private function handleBrowse(e:MouseEvent):void
               file = new FileReferenceList();
               file.addEventListener(Event.SELECT, handleSelect);
               file.browse();
          private function handleSelect(e:Event):void
               for(var i:int = 0; i < file.fileList.length; i++)
                    realList.push(file.fileList[i]);
                    var name:String = file.fileList[i].name.toString();
          private function handleUpload(e:MouseEvent):void
               var t:String = "http://domain.com/upload.php";
               /** Show that we are uploading **/
               var colorTransform:ColorTransform =  new ColorTransform();
               colorTransform.color = 0xff0000;
               browseBtn.transform.colorTransform = colorTransform;
               /** No files to be uploaded **/
               if(realList.length <= 0)
                    return;
               /** Create an url request **/
               var url:URLRequest = new URLRequest(t);
               /** Start uploading **/
               for(var i:int = 0; i < realList.length; i++)
                    realList[i].addEventListener(ProgressEvent.PROGRESS, handleProgress);
                    realList[i].addEventListener(Event.COMPLETE, handleComplete);
                    realList[i].upload(url);
          private function handleProgress(e:ProgressEvent):void
                        /** Update text fields with the bytes **/
               prgrs.text = e.bytesLoaded.toString();
               ttlsize.text = e.bytesTotal.toString();
          private function handleComplete(e:Event):void
There's the code.
My problem is that when I'm running this code, the progress jumps to 50%, then to 100% (even when the file is no where near finished)... After a while Event.COMPLETE is fired.
When others (3 other people) run it, the progress increases progressively (yep) and when its done it fires Event.COMPLETE accordingly (so everything goes well on their run).
Flash player versions:
WIN 10,1,103,19 < Mine, Firefox/Chrome/IE8 (Tested all of em)
MAC 10,1,103,19
WIN 10,1,102,64
WIN 10,1,103,19

Similar Messages

  • Warnings in FileReference - can not find the cause

    I'm trying to make a loader of a few photos (use FileReference). I get the warnings, but I do not know the reason for their appearance.
    warning: unable to bind to property 'fr' on class 'Object' (class is not an IEventDispatcher)
    warning: unable to bind to property 'name' on class 'flash.net::FileReference'
    warning: unable to bind to property 'data' on class 'flash.net::FileReference'
    warning: unable to bind to property 'fr' on class 'Object' (class is not an IEventDispatcher)
    warning: unable to bind to property 'name' on class 'flash.net::FileReference'
    warning: unable to bind to property 'data' on class 'flash.net::FileReference'
    CODE:
    import mx.events.CollectionEvent;
    import flash.net.FileReferenceList;
    import mx.collections.ArrayCollection;
    [Bindable]
    private var photos:ArrayCollection = new ArrayCollection;
    private var frList:FileReferenceList = new FileReferenceList;
    private function init():void
    photos.addEventListener(CollectionEvent.COLLECTION_CHANGE,function():void
    startUploadButton.enabled = (photos.length>0);
    clearPhotosButton.enabled = (photos.length>0);
    frList.addEventListener(Event.SELECT,addPhotos);
    private function selectPhotos():void
    var fileFilter:FileFilter = new FileFilter("Images jpeg","*.jpg;*.jpeg");
    frList.browse([fileFilter]);
    private function addPhotos(e:Event):void
    for (var i:uint = 0; i < frList.fileList.length; i++)
    var elem:Object = new Object;
    elem.fr = FileReference(frList.fileList[i]);
    elem.fr.load();
    elem.fr.addEventListener(Event.COMPLETE,refreshThumb);
    photos.addItem(elem);
    private function refreshThumb(e:Event):void
    photosList.invalidateList();
    public function clearPhoto(data:Object):void
    photos.removeItemAt(photos.getItemIndex(data));
    photosList.invalidateList();
    private function startUpload():void
    photosProgressContainer.visible = true;
    var request:URLRequest = new URLRequest();
    request.url = "http://localhost/tempLoader-debug/upload.php";
    var fr:FileReference = photos.getItemAt(0).fr;
    fr.cancel();
    fr.addEventListener(ProgressEvent.PROGRESS,uploadProgress);
    fr.addEventListener(DataEvent.UPLOAD_COMPLETE_DATA,uploadComplete);
    fr.upload(request);
    private function uploadProgress(e:ProgressEvent):void
    photosProgress.setProgress(e.bytesLoaded,e.bytesTotal);
    private function uploadComplete(e:DataEvent):void
    photos.removeItemAt(0);
    photosList.invalidateList();
    if (photos.length > 0)
    startUpload();
    else
    photosProgressContainer.visible = false;

    In my opinion this is the line that is causing you the warning:
    <mx:Image source="{data.fr.data}" maxWidth="100" maxHeight="75"
    horizontalAlign="center" verticalAlign="middle" />
    That means that data should be a custom binable object and fr should be another
    custom bindable object.
    like
    public class BindableData
        public var fr:BindableData2;
    public class BindableData2
        public var data:String;
    I am not sure though what you are trying to do though, but I assume you try top
    load an image from your disk. This link will help you:
    view source enabled...
    http://www.everythingflex.com/flex3/flexcampItaly/
    the blog post ...
    http://blog.everythingflex.com/2009/09/08/flexcamp-presentation-filereference-load-part-1- of-3/
    C
    From: Astraport2012 <[email protected]>
    To: Ursica Claudiu <[email protected]>
    Sent: Sun, October 3, 2010 3:07:57 PM
    Subject: Re: Warnings in FileReference - can not find the cause
    I found the solution to the first part of the warning. Only need to modify the
    object as ObjectProxy
    public var elem:ObjectProxy = new ObjectProxy;
    But with the second part is still a problem (warning: unable to bind to property
    'name' on class 'flash.net::FileReference'
    warning: unable to bind to property 'data' on class 'flash.net::FileReference').
    I do not fully describe the problem in the first message. The main application
    calls the component and passes it parameters. They cause errors.
    It is this component photoThumb.mxml:
    <?xml version="1.0" encoding="utf-8"?>
       width="120" height="110"
       backgroundColor="#FFFFFF" backgroundAlpha="0"
       rollOver="{controls.visible=true;}" rollOut="{controls.visible=false;}">
    <mx:Image source="@Embed('t1.png')" width="100%" height="100%" alpha="0"
    horizontalAlign="center" verticalAlign="middle"/>
    <mx:VBox width="100%" height="90" y="5" horizontalAlign="center" >
    <mx:Image source="{data.fr.data}" maxWidth="100" maxHeight="75"
    horizontalAlign="center" verticalAlign="middle" />
    </mx:VBox>
    <mx:Label text="{data.fr.name}" width="118" truncateToFit="false" bottom="0"
    textAlign="center" />
    <mx:VBox id="controls" visible="false" y="65" right="10" horizontalAlign="right"
    >
    <mx:Button label="X" click="parentDocument.clearPhoto(data)" fontSize="6"
    width="30" height="15" />
    </mx:VBox>
    </mx:Canvas

  • FileReference Select and Cancel Event Not Working in leopard

    FileReference not working in leopard
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute">
    <mx:Script>
    <![CDATA[
    import mx.controls.Alert;
    public function onClick():void{
    var fr:FileReference=new FileReference();
    //fr.addEventListener(
    fr.addEventListener(Event.OPEN,openHandler);
    fr.addEventListener(Event.COMPLETE,completeHandler);
    fr.addEventListener(Event.SELECT,selectHandler);
    fr.addEventListener(Event.CANCEL,cancelHandler);
    fr.addEventListener(DataEvent.UPLOAD_COMPLETE_DATA,uploadCompleteDataHandler);
    fr.addEventListener(HTTPStatusEvent.HTTP_STATUS,httpStatusHandler);
    fr.addEventListener(IOErrorEvent.IO_ERROR,ioErrorHandler);
    fr.addEventListener(ProgressEvent.PROGRESS,progressHandler);
    fr.addEventListener(SecurityErrorEvent.SECURITY_ERROR,securityErrorHandler);
    fr.browse([new FileFilter("images", "*.png;*.jpg;*.gif")]);
    private function cancelHandler(event:Event):void {
    trace("cancelHandler: " + event);
    private function completeHandler(event:Event):void {
    trace("completeHandler: " + event);
    private function
    uploadCompleteDataHandler(event:DataEvent):void {
    trace("uploadCompleteData: " + event);
    private function
    httpStatusHandler(event:HTTPStatusEvent):void {
    trace("httpStatusHandler: " + event);
    private function ioErrorHandler(event:IOErrorEvent):void {
    trace("ioErrorHandler: " + event);
    private function openHandler(event:Event):void {
    trace("openHandler: " + event);
    private function progressHandler(event:ProgressEvent):void {
    var file:FileReference = FileReference(event.target);
    trace("progressHandler name=" + file.name + " bytesLoaded="
    + event.bytesLoaded + " bytesTotal=" + event.bytesTotal);
    private function
    securityErrorHandler(event:SecurityErrorEvent):void {
    trace("securityErrorHandler: " + event);
    private function selectHandler(event:Event):void {
    Alert.show("XD");
    ]]>
    </mx:Script>
    <mx:Button x="205" y="198" label="Button"
    click="onClick()"/>
    </mx:Application>
    Adobe Flex Builder 3 Beta3
    Leopard 10.5.1
    both Safari and firefox doesn't work

    Flash version is 115 debug player

  • How to properly use ProgressEvent's bytesLoaded and bytesTotal for file download

    Hi All,
    I am using Flex 4, Actionscript 3.
    I am using FileReference's download method, which automatically opens  the "Save As" dialog window (ie. I don't have to explicitly call browse  like for an upload).
    I'd like the label of my ProgressBar component to display
    downloading <%> ...
    In my ProgressEvent handler, I tried
    Code:
         prgbr_fileDownload.label = "downloading %3%%...";
         prgbr_fileDownload.setProgress( event.bytesLoaded, event.bytesTotal );
    But this just displayed "downloading ...". I already set the mode of my ProgressBar component to "manual".
    I then tried
    Code:
    prgbr_fileDownload.label = "downloading " + Math.round( ( event.bytesLoaded/event.bytesTotal ) * 100 ) + "% ...";
    And I was shocked to see very large numbers.
    I then noticed my trace statements displaying the following:
    Code:
    progressHandler name = g2.zip bytesLoaded = 98304 bytesTotal = 98304
    progressHandler name = g2.zip bytesLoaded = 196608 bytesTotal = 98304
    progressHandler name = g2.zip bytesLoaded = 377421 bytesTotal = 98304
    etc.
    progressHandler name = g2.zip bytesLoaded = 17820389 bytesTotal = 98304
    progressHandler name = g2.zip bytesLoaded = 17829381 bytesTotal = 98304
    progressHandler name = g2.zip bytesLoaded = 17838373 bytesTotal = 98304
    etc.
    progressHandler name = g2.zip bytesLoaded = 29940557 bytesTotal = 98304
    progressHandler name = g2.zip bytesLoaded = 30012485 bytesTotal = 98304
    progressHandler name = g2.zip bytesLoaded = 30103874 bytesTotal = 98304
    Hence, obviously my last computation would not work.
    How can I get the percentage downloaded to be displayed correctly?
    Thanks,
    Bonnie

    Hello,
    You're already using it correctly on first try (assigning bytes loaded, bytes total to relevant progress bar instance should update correctly setup label to display percentage as ProgressBar *has* that kind of logic already built-into its code). Are you following that tutorial maybe?
    http://livedocs.adobe.com/flex/3/html/help.html?content=17_Networking_and_communications_9 .html
    It does its job as I quickly tested - and it shows how to setup ProgressBar label to *percentage* option - which is computed by component itself.
    To compute percentage you compare current value (which should be less or equal) to expected "total" bytes value:
    http://en.wikipedia.org/wiki/Percentage
    No magic here - the only issue that people could face is that sometimes "bytesTotal" is reported with wrong value (e.g. zeor) as server does not set correct "Content-Length" value (but I nearly 100% sure that is not in your case).
    If you have issue with your example url server just use established content for testeing, e.g. nasa.gov hosted image (it never tricked me):
    http://www.nasa.gov/images/content/566830main_201107060001HQ_full.jpg
    (I'm using nasa.gov imagery for download tests as they are providing hi-res content which is fun to look into as well),
    regards,
    Peter

  • How do you download a static file using a FileReference and URLRequest and show the progress?

    All,
       I'm trying to download static content (PDFs) off of my server using tutorials from adobe's site and some online as well and i'm having no luck showing an updated progress bar.  I attached the meat of my code below.  If a user clicks a hyperlink, it calls the downloadPDF method passing in a constant url defined.
      When debugging, i can see that the event.bytesLoaded is incrementing on each call to the progress method, however the bytesTotal is only set to the intitial number of bytes transferred on the first pass through the method.  (Ex:  First time the method is called, bytesLoaded and bytesTotal will be 4,000... which i dont understand... the bytesTotal should be the total size of the file being downloaded.. definitely not the case...  the next time the method is called, bytesLoaded will increases to some number while bytesTotal will remain at 4,000).  This happens during the entire file transfer.
    Am i missing something? Are the examples incorrect?  Also to note, i'm using sdk 3.2 (Not sure if that makes a difference.)
    Thanks for any response or insight.
    Damian
    <mx:Script>
            <![CDATA[
                import com.ctc.fema.resources.Buttons;
                import flash.net.FileReference;
                private var fileRef:FileReference;
                private var urlReq:URLRequest;
                 * Constant values for user manual pdfs
                private static const PDF_STRING:String = "blahblahblah.pdf";
                private function init():void
                    /* Define file reference object and add a bunch of event listeners. */
                    fileRef = new FileReference();
                    fileRef.addEventListener(Event.COMPLETE, completeHandler);
                    fileRef.addEventListener(Event.OPEN, openHandler);
                    fileRef.addEventListener(ProgressEvent.PROGRESS, progressHandler);
                private function doEvent(evt:Event):void
                    /* Create shortcut to the FileReference object. */
                    var fr:FileReference = evt.currentTarget as FileReference;
                    try
                        /* Update the Model. */
                        fileRefModel.creationDate = fr.creationDate;
                        fileRefModel.creator = fr.creator;
                        fileRefModel.modificationDate = fr.modificationDate;
                        fileRefModel.name = fr.name;
                        fileRefModel.size = fr.size;
                        fileRefModel.type = fr.type;
                        /* Display the Text control. */
                    catch (err:*)
                        /* uh oh, an error of sorts. */
                private function downloadPDF(url:String):void
                    /* Begin download. */
                    urlReq = new URLRequest(url);
                    fileRef.download(urlReq);
                 * When the OPEN event has dispatched, change the progress bar's label
                 * and enable the "Cancel" button, which allows the user to abort the
                 * download operation.
                private function openHandler(event:Event):void
                    downloadStatusContainer.visible = true;
                    downloadStatusContainer.includeInLayout = true;
                    downloadProgressBar.label = "DOWNLOADING %3%%";
                    cancelButton.enabled = true;
                 * While the file is downloading, update the progress bar's status.
                private function progressHandler(event:ProgressEvent):void
                    downloadProgressBar.setProgress(event.bytesLoaded, event.bytesTotal);
                 * Once the download has completed, change the progress bar's label one
                 * last time and disable the "Cancel" button since the download is
                 * already completed.
                private function completeHandler(event:Event):void
                    downloadStatusContainer.visible = false;
                    downloadStatusContainer.includeInLayout = false;
                    downloadProgressBar.label = "DOWNLOAD COMPLETE";
                    cancelButton.enabled = false;
                 * Cancel the current file download.
                public function cancelDownload():void
                    fileRef.cancel();
                    downloadProgressBar.label = "DOWNLOAD CANCELLED";
                    cancelButton.enabled = false;
                    downloadStatusContainer.visible = false;
                    downloadStatusContainer.includeInLayout = false;
            ]]>
        </mx:Script>

    The tick counter has a resolution of 1 ms.  Resolution, accuracy, and the responsiveness of the OS are three different things.  The issue is that OS latency can be 10s of milliseconds or occasionally longer.  If the OS decides to index the hard drive between the time you read the tick count and send the start audio command, your tone could be quite late. Sending the TTL pulse is a third call to the OS.  So you have two latency times for each trial. Unless you have a real-time operating system, this latency issue will introduce randomness into your data.
    Try sending TTL pulses of 50 ms duration every 200 ms, software timed, for a few minutes and look at the variation in the edge timing.  Then try it again with tones thrown into the mix and see if the variation changes. 
    That is where hardware timing and synchronization pays off. 
    Lynn 

  • Strange problem with ProgressEvent.PROGRESS in different laptob

    i made simple of my project to show the problem
    the code
    package
         import flash.display.MovieClip;
         import flash.net.FileReference;
         import flash.net.FileFilter;
         import flash.events.MouseEvent;
         import flash.events.*;
        import flash.net.URLRequest;
         import flash.net.FileReferenceList;
         import flash.net.URLVariables;
         import flash.net.URLRequestMethod;
         public class Control extends MovieClip
              public var allTypes:Array;
              public var imageTypes:FileFilter;
              public var textTypes:FileFilter;
              public var fileRef:FileReference;
              public var request:URLRequest;          
              public function Control()
                   imageTypes = new FileFilter("Images (*.jpg, *.jpeg, *.gif, *.png)", "*.jpg; *.jpeg; *.gif; *.png");
                   textTypes = new FileFilter("Text Files (*.txt, *.rtf)", "*.txt; *.rtf");
                   allTypes = new Array(imageTypes, textTypes);
                   upload_icon.addEventListener( MouseEvent.CLICK, upload_icon_click);
                   add_icon.addEventListener( MouseEvent.CLICK, add_icon_click);
                   function add_icon_click (e:MouseEvent):void
                        fileRef = new FileReference();
                        fileRef.addEventListener(Event.SELECT, selectHandler);
                        fileRef.addEventListener(Event.COMPLETE, completeHandler);
                        fileRef.addEventListener(ProgressEvent.PROGRESS, progressHandler);
                        fileRef.addEventListener(DataEvent.UPLOAD_COMPLETE_DATA,uploadCompleteDataHandler);
                        try
                             var success:Boolean = fileRef.browse();
                        catch (error:Error)
                             trace("Unable to browse for files.");
                   function uploadCompleteDataHandler(event:DataEvent):void {
                        //result = ExternalInterface.call("error_file_upload", "uploadCompleteData: " + event.data);
                        trace("uploadCompleteData: " + event.data);
                   function selectHandler(event:Event):void
                        testout.text=testout.text+fileRef.name+"==="+fileRef.size+"==="+fileRef.type+"\n";
                        trace(fileRef.name+"==="+fileRef.size+"==="+fileRef.type+"\n");
                   function upload_icon_click (e:MouseEvent):void
                        request = new URLRequest("http://egyouth.com/mahmoud/test/upload.php");
                        var valebal:URLVariables       =  new URLVariables();
                        valebal.login_send_info        =  4;
                        valebal.user                        =  'mahmoud';
                        request.method                 =  URLRequestMethod.POST;
                        request.data                   =  valebal;
                        try
                             fileRef.upload(request);
                        catch (error:Error)
                             trace("Unable to upload file.");
                   function completeHandler(event:Event):void
                        trace("trace");
                   function progressHandler(event:ProgressEvent):void
                        testout.text=testout.text+fileRef.name+"==="+fileRef.size+"==="+fileRef.type+"=="+event.bytesLoaded+"==="+event.bytesTotal+"\n";
                        trace(fileRef.name+"==="+fileRef.size+"==="+fileRef.type+"=="+event.bytesLoaded+"==="+event.bytesTotal+"\n");
    this code you can test on
    http://egyouth.com/mahmoud/test/mahmoud.html
    the problem is when i try this code in my computer progressHandler function work very good
    like if i upload 5mb it take like 1m and every 1sec he run progressHandler function
    but when i run this code in deferent computer use the same speed ( same network)
    i upload 5mb and  progressHandler function run very fast and just take 2 secand and tell me the file upload
    but the file not upload and after 1 m i will see it in the upload folder
    http://egyouth.com/mahmoud/test/files/
    so what the problem now ( i think in the secand computer the as3 thought that he upload use the speed of computer not the speed of the network like my laptob )
    just for trace my laptob run with adobe flash player 10.0.2.54
    and
    the second computer run with adobe flash player 10.0.45.2

    in the second computer run with adobe flash player 10.0.45.2 progressHandler function run very fast ex
    when i upload a 100mb it must take 30min but it just take 4 sec !! and it tell me the upload done
    but when i open the folder of upload i didnt see the file
    and if i still open the page of upload i will see the folder after 30min
    i think that progressHandler function in this computer use the speed of computer not the speed of network

  • Antivirus software breaks FileReference.upload() method...

    Hi there,
    I'm a Flash developer who's run into an interesting problem since upgrading to AVG 9 (free antivirus software).
    I use Flash to facilitate large uploads to websites (eg. video). I've built plently of upload widgets that use Flash's FileReference.upload() method to send a file from a users computer to a webserver.
    It seems that since upgrading to AVG 9, the bytesLoaded property of a ProgressEvent is being updated at warp speed - a 30mb file appears sent to a server in less than a second! Which is ridiculous. So in an instant, the bytesLoaded property equals the bytesTotal property. Seemingly an arbitrarily time later, the Event.COMPLETE event fires (I think this arbitrarial illusion is caused by the upload continuing in the background). If everything was running as it's supposed to, this should generally be followed by a DataEvent.UPLOAD_COMPLETE_DATA event firing. But now, because of all this weirdness, no DataEvent.UPLOAD_COMPLETE_DATA event is firing.
    After a bit of websurfing I found other developers having problems with this because of virus software - so I've uninstalled AVG and "voila!", Flash now works as it is supposed to when uploading a file again.
    I guess I could build a polling timer into my uploader to continually ping the server to check that my upload had complete and grab my upload complete data that way, but that'd be annoying as heck.
    Any ideas what's going on? This is kind of a massive problem, ProgressEvent returning bogus bytesLoaded data, isn't it?
    Kind regards,
    James.

    James Furey:
    I agree in disabling the LinkScanner. Open AVG User Interface, Dbl click on the LinkScanner and Untick the "Enable AVG Search-Shield" and the "Enable Active Surf-Shield" then SAVE the changes made.
    eidnolb
    Message was edited by: eidnolb

  • Socket ProgressEvent.SOCKET_DATA

    I'm in trouble now.
    see flash.net.Socket
    My question:
    If the data being transmitted is very small or it happens
    very quickly, does ProgressEvent.SOCKET_DATA event might not be
    dispatched?
    Why I ask like this?
    Because, see flash.net.FileReference's ProgressEvent.PROGRESS
    event:
    In some cases, progress events are not received. For example,
    when the file being transmitted is very small or the upload or
    download happens very quickly a progress event might not be
    dispatched.
    thanks very much.

    Hi, has anyone discovered what is happening with this? I am having the same problem and also happen to be on a Vista 64bit system.
    I am able to reproduce the problem quite easily for anyone that already has a server loop set up and is sending messages to their flash client.
    In your flash SocketData handler function, just add a long loop, something like this:
    private function onSocketData (e:ProgressEvent):void
         var count:int = 0;
         while (count < 1000*1000)
              count++;
    The problem that I seem to be getting, is that in the time it takes my handler function to process the data, new data has arrived from my server loop (keeps sending messages super fast). It seems the new data is either getting queued up (although if it is, it's not being given to me in the order it arrives) or that the data is just being ignored/lost.
    Does anyone have any insight on this?
    I've added a delay of 100ms to the server loop and everything works fine, but this is definately not a long term solution and I've only done so to check if it is in fact the Flash side that's really buggered.
    Come to think of it, I'll try making my flash side extremely fast by simply dispatching a new event on the socketdata handler and see if those events get queued and/or lost/destroyed.

  • Previewing an image before uploading it using the FileReference class

    Previewing an image before uploading it using the FileReference class in flash player 3 not in SDK4

    Previewing an image before uploading it using the FileReference class in flash player 3 not in SDK4

  • Previewing an image before uploading it using the FileReference class in flex 3

    Previewing an image before uploading it using the FileReference class in flex 3 ?

    hai,
              when this code is used in my application ,i got the name of image and new frame is added each time .But image is not displayed.....
    The code  starts like this
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Canvas xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
                xmlns:mx="library://ns.adobe.com/flex/mx" initialize="init()"   backgroundColor="white" width="100%" height="100%">
        <fx:Script>
    <![CDATA[ 
                    import mx.controls.Alert;
                    import mx.messaging.Channel;
                    import mx.messaging.ChannelSet;
                    import mx.messaging.channels.AMFChannel;
                    import mx.rpc.events.ResultEvent;
                    import mx.controls.Image;
                    import spark.events.IndexChangeEvent;
                    import mx.managers.DragManager;
      <mx:DataGridColumn headerText="Dimension Value"  width="10" dataField="dimensionValue"/>
                                                   <mx:DataGridColumn headerText="Unit Nmae"  width="10" dataField="dimensionUnitName"/>
                                                   </mx:columns>
                                           </mx:DataGrid>
                                           <mx:Spacer width="2%"/>
                                       </mx:HDividedBox>
                                       </mx:VBox>
                   <mx:Spacer height="0"/>
                <mx:VBox width="100%">
                    <s:HGroup height="90" top="0" left="0" right="0" verticalAlign="justify" gap="10" paddingLeft="5" paddingRight="5" paddingTop="5" paddingBottom="5">
                        <s:Button id="btn_loader" top="5" bottom="24" width="100" label="load" click="loadImages()"/>
                        <s:Group width="100%">
                            <s:Group name="cl" top="0" left="0" bottom="0" width="20" mouseOver="//scroll_on(event)" mouseOut="//scroll_off(event)">
                                <s:BitmapImage source="@Embed('../assets/left.jpg')" top="0" left="0" bottom="0" right="0" fillMode="scale"/>   
                            </s:Group>
                            <s:List id="imgList" skinClass="skins.ListSkin" top="-3" left="27" right="28" bottom="10"
                                    dataProvider="{ImageCollection}" itemRenderer="Image_Render">
                                <s:layout>
                                    <s:HorizontalLayout gap="0"/>
                                </s:layout>
                            </s:List>
                            <s:Group name="cr" top="0" right="0" bottom="0" width="20" mouseOver="//scroll_on(event)" mouseOut="//scroll_off(event)">
                                <s:BitmapImage source="@Embed('../assets/right.jpg')" top="-1" left="0" bottom="0" right="0" fillMode="scale"/>
                            </s:Group>
                        </s:Group>
                    </s:HGroup>
                    <s:SkinnableContainer id="dropCanvas" top="100" left="5" right="5" bottom="5" backgroundAlpha="1.0" alpha="1.0"
                                          dragEnter="dropCanvas_dragEnterHandler(event)"
                                          dragDrop="dropCanvas_dragDropHandler(event)" contentBackgroundColor="#914E4E" backgroundColor="#F7F7F7">
                    </s:SkinnableContainer>
                </mx:VBox>
                <mx:Spacer height="5"/>
                                      </mx:VDividedBox>
        </mx:Panel>
    </mx:Canvas>

  • FileReference class

    Afther all, I send you all my best greetings.
    I have been trying an example of downloading a file from the server with the FileReference class in Flex (Action script 3). It works with files upto 4 Gb.
    For larger files, the resulting downloaded file is incomplete.
    I read in the Documentation that the member variable"size" should be defined as Number object. But in my developing enviorment (Flash Builder 4), the "size" member variable is defines as "uint".. Therefore, it only can handle files upto 4G. According to the doco, the latest versions of action script 3 should be "size" aNumber object.
    Does anybody has seen that problem ? .. Is there a way to actualize the fileReference class ? ..
    Marco

    Please submit this enhancement into the bug tracking system
    for the actionscript compiler:
    http://bugs.adobe.com/asc/

  • Uploading bitmapData using FileReference class ?

    Hi gurus ;)
    Question nr 1.
    Is it possibly to upload bitmapData to server using
    FileReference class ? How should i approach this issue, is there
    any ready classes available for this purpose. I'm generating
    bitmaps inside my Flash/Flex App and need to store them under users
    profile in server.
    Question nr 2.
    Can i upload files from remote server to another using
    FileReference class
    e.g Somehow like :
    uploadURL = new URLRequest();
    uploadURL.url = "
    http://www.[yourDomain
    fileURL.url = "
    http://www.myLocation.com/myfile.JPG";
    file = new FileReference(fileURL.url);
    file.upload(uploadURL);
    This is just an idea, sure not working ;)
    Any ideas are helpful
    Thx
    iquaaani

    I did a small application that uploads a file to the server
    every hour. If the server response that a login is required to
    upload the file, it goes to a login page to do the login and
    retried to upload the file.
    I got the server response in order to know if the file did
    upload correctly or not (I have to send more form data than just
    the file). I didn't try the mime type since it's not relevant for
    my application and usualy this information is not very trust worthy
    anyways.
    I'm not sure what you mean with exceptions, if you are
    referring to HTTP errors, I think there is an event for that, but I
    used the IOError event for this, and it seems to work good
    also.

  • Problems while uploading files using the FileReference API

    I've built an image uploader module in Flex using the FileReference API and PHP.
    While this works perfect for images upto 1 MB, What I'm noticing is that for images greater that 1 MB even after the Event.COMPLETE  has triggered, the file hasn't yet been uploaded into the folder.. its only after a couple of seconds or minutes after the Event.COMPLETE,  that the image actually shows up in the FTP folder. Morever I also noticed that for such files the DataEvent.UPLOAD_COMPLETE_DATA that we are using to get feedback from PHP never gets called.
    I thought it would be related to the PHP script getting timed out... but the PHP script does get executed and the images do show up in the folder but thats way after the Event.Complete has been triggered and more importantly  DataEvent.UPLOAD_COMPLETE_DATA doesnt get called.
    Everything seems to work fine as long as the file size is under 1 MB
    Did others too face similar problems and any ideas on how to fix it?
    Thanks in advance

    I don't believe there is, as the browse button renders out as an html input type file component, and this has no ability to get native file size from the client. The only way to do it is to check the file size server side, but that kind of defeats the purpose to some extent, as the file is required to be uploaded before the file size can be checked.
    There is no way to do this on the client short of using a third party client side component - ie. java, flash or some other active component that gets file system level access.
    Ben

  • Using the fileReference class to upload image

    I've been using the loadVars to upload text and pass
    variables to php and onto the server. I've begun using the Flash
    Filereference class so an image can be uploaded directly from a
    Flash movie, not involving an html form. But within the
    Filereference script I can't figure out how to pass a variable to
    php as I did using loadVars method. I've tried a number of hit-miss
    ways but they've all been misses.
    Right now the path to save an image file is "hard-wired" into
    the php script. This is the var that I want to pass.
    thanks
    The script is here if you need to take a peek:

    Someone else asked about this recently. I think the answer
    you're after is here:
    http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=15&catid=288&threadid =1317799
    That's for POST data.
    If you want to send additional GET data you could just append
    it to the url.

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

    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 10.0.45.2
    Safari 4.0.5 w/ Flash Plugin 10.0.45.2
    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:
    http://www.adobe.com/devnet/flash/quickstart/filereference_class_as3/
    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:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/halo"
                   xmlns:net="flash.net.*" xmlns:mx1="library://ns.adobe.com/flex/mx"
                   creationComplete="init()">
      <fx:Script>
        <![CDATA[
          import mx.controls.Alert;
          import mx.utils.ObjectUtil;
          [Bindable]
          private var appX:Number;
          [Bindable]
          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"));
            fileReference.browse(arr);
          private function fileReference_select(evt:Event):void {
            fileReference.load();
          private function fileReference_complete(evt:Event):void {
            img.source = fileReference.data;
            Alert.show(ObjectUtil.toString(fileReference));
        ]]>
      </fx:Script>
      <fx:Declarations>
        <net:FileReference id="fileReference"
                           select="fileReference_select(event);"
                           complete="fileReference_complete(event);" />
      </fx:Declarations>
      <s:Panel id="panel"
                horizontalCenter="0"
                verticalCenter="0"
                width="500">
        <s:layout>
          <s:VerticalLayout />
        </s:layout>
        <mx1:Image id="img"
                  verticalCenter="0"
                  horizontalCenter="0"
                  maxWidth="200"
                  maxHeight="200" />
        <mx1:ControlBar>
          <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}" />
        </mx1:ControlBar>
      </s:Panel>
    </s:Application>
    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

    Updates:
    I've opened a bug with Adobe regarding this issue:
    http://bugs.adobe.com/jira/browse/FP-4362
    Also, the Cancel operation on a FileReference causes the same issue to happen as does loading.  I really think it's an operating system focus issue.
    UPDATE:
    Looks like this has already been tracked and is scheduled to be fixed:
    https://bugs.adobe.com/jira/browse/FP-2785

Maybe you are looking for

  • Coping iso file and monting problem

    Hi I am using Windows 8.1 Update Enterprise 64 bit and Windows ADK. I noticed that, if I select the "Environment of the deployment tools and creations images" and I click on the "Run as Administrator" item of his Pop-Up menu and I mount on a iso imag

  • Acrobat X freezes when I run a JavaScript Action after about 200 files.

    Acrobat X freezes when I run a JavaScript Action after about 200 files, batches with less than 200 files work well.  I can watch the Acrobat.exe process in the resource monitor and when the Threads reach about 2000 and the Working Memory reaches 500m

  • Problem with my touch screen. It works for 1 or 2 minutes and then it doesn't work for 2 or 3 minutes !!

    hi everybody I have a problem with my touch screen. It works for 1 or 2 minutes and then it stops working for 2 or 3 minutes, this is a loop ! if I don't use for a couple of hours it will work more, about 15 minutes and then stops working !!! whats w

  • IDOC2FILE

    Hi All, Now i am working IDOC2FILE scenario. All design time & configuration time objects are created and activated successfully. And ALE settings also done in both R/3 side and XI side. Now i am trying to send the idoc in we19, but i got the error l

  • Unable too see two nodes RAC

    Hi All, Hope you are fine, here same. According to my daily activities i use to check alert log file, db growth etc etc... number of end users on both nodes.. Problem: I use to check number of end users on both nodes i.e SQL> select inst_id, count(*)