                 data.position = 0;
                 if (_resource)
                 {
-                    var prev:uint = _resource.position;
+                    var prev : uint = _resource.position;
                     data.readBytes(_resource, _resource.length);
                     _resource.position = prev;
                 }
                 else
                     _resource = data;
                 // XXX arik: get finalLength from js
-                var finalLength:uint = _resource.length;
+                var finalLength : uint = _resource.length;
                 dispatchEvent(new ProgressEvent( ProgressEvent.PROGRESS, false,
                     false, _resource.length, finalLength));
             }

        private var _curr_data : Object;
        private var _hola_managed : Boolean = false;
        private var _req_id : String;

        public function JSURLStream(){
            _hola_managed = HSettings.enabled && ExternalInterface.available;
            addEventListener(Event.OPEN, onOpen);
            super();
            if (!_hola_managed || js_api_inited)
                return;

            this.dispatchEvent(new Event(Event.OPEN));
        }

        private function onopen(e : Event) : void { _connected = true; }

        private function onerror(e : ErrorEvent) : void {
            _delete();
            if (!_events.error)
                return;
            _trigger('onRequestEvent', {req_id: _req_id, event: 'error',
                error: e.text, text: e.toString()});
        }

        private function onprogress(e : ProgressEvent) : void {
            _size = e.bytesTotal;
            if (!_events.progress)
                return;
            _trigger('onRequestEvent', {req_id: _req_id, event: 'progress',
                loaded: e.bytesLoaded, total: e.bytesTotal,
                text: e.toString()});
        }

        private function onstatus(e : HTTPStatusEvent) : void {
            if (!_events.status)
                return;
            // XXX bahaa: get redirected/responseURL/responseHeaders
            _trigger('onRequestEvent', {req_id: _req_id, event: 'status',
                status: e.status, text: e.toString()});
        }

        private function oncomplete(e : Event) : void {
            _delete();
            if (!_events.complete)
                return;
            _trigger('onRequestEvent', {req_id: _req_id, event: 'complete',
                size: _size, text: e.toString()});
        }

        private function decode(str : String) : void {
            if (!str)
