actionscript-3flashuploadfilereferenceioerror

AS3 Error 2038 on Windows only


hope someone can help me with this!

I've written a simple online 3d editor in Flash - it's about to go out to a selection of clients but the file uploader has a bit of a glitch which has only just reared its ugly head. Using FileReference to upload media to https page, it works like a dream on OSX which is what it was built on, but on Windows it's returning Error 2038 on every browser. Has anyone encountered this before?

Any help much appreciated!

public class CustomFileReferenceList extends FileReferenceList {

    private var uploadURL:URLRequest;
    private var pendingFiles:Array;

    public static var length:int = 0;
    public static var arrLen:int = 0;

    public function CustomFileReferenceList() {
        uploadURL = new URLRequest();
        uploadURL.url = "https://___";
        var rqd:URLVariables = new URLVariables();
        uploadURL.method = URLRequestMethod.POST;
        rqd.sessionId = Main.sessionId;
        uploadURL.data = rqd;
        initializeListListeners();
    }

    private function initializeListListeners():void {
        addEventListener(Event.SELECT, selectHandler);
        addEventListener(Event.CANCEL, cancelHandler);
    }

    private function doOnComplete():void {
        //var event:Event = new Event(Uploader.LIST_COMPLETE);
        //dispatchEvent(event);
enter code here
    }

    private function addPendingFile(file:FileReference):void {
        pendingFiles.push(file);
        file.addEventListener(Event.OPEN, openHandler,false,0,true);
        file.addEventListener(Event.COMPLETE, completeHandler,false,0,true);
        file.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler,false,0,true);
        file.addEventListener(ProgressEvent.PROGRESS, progressHandler,false,0,true);
        file.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler,false,0,true);
        file.upload(uploadURL);
    }

    private function removePendingFile(file:FileReference):void {
        for (var i:uint; i < pendingFiles.length; i++) {
            if (pendingFiles[i].name == file.name) {
                pendingFiles.splice(i, 1);
                if (pendingFiles.length == 0) {
                    doOnComplete();
                }
                return;
            }
        }
    }

    private function selectHandler(event:Event):void {


        arrLen = length = fileList.length;
        pendingFiles = new Array();
        var file:FileReference;
        for (var i:uint = 0; i < fileList.length; i++) {
            file = FileReference(fileList[i]);
            addPendingFile(file);
        }
    }

    private function cancelHandler(event:Event):void {
        //var file:FileReference = FileReference(event.target);
    }

    private function openHandler(event:Event):void {
        var file:FileReference = FileReference(event.target);
    }

    private function progressHandler(event:ProgressEvent):void {
        var file:FileReference = FileReference(event.target);
    }

    private function completeHandler(event:Event):void {
        var file:FileReference = FileReference(event.target);
        length--;
        removePendingFile(file);
    }

    private function httpErrorHandler(event:Event):void {
        var file:FileReference = FileReference(event.target);
    }

    private function ioErrorHandler(event:Event):void {
        var file:FileReference = FileReference(event.target);
    }

    private function securityErrorHandler(event:Event):void {
        var file:FileReference = FileReference(event.target);
    }
}

Solution

  • After trying just about every solution, the other web dev found it worked ok minus fancy url names i.e referencing ourserver/thepage.php instead of ourserver/service. Absolutely crazy.