kverweij / stagewebviewbridge

Automatically exported from code.google.com/p/stagewebviewbridge
0 stars 0 forks source link

Override of addEventListner does not implement ErrorEvent.ERROR to this._view in StageWebViewBridge #26

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Point the created StageWebViewBridge to a non existing location (or 
disconnect internet connection), for example: 
this.webView.loadURL('http://galamagala.com');

What is the expected output? What do you see instead?
Expected: Binded error event must be handled by event handler proc
I see: Error #2044: Unhandled ErrorEvent:. text=Load error.

What version of the product are you using? On what operating system?
- Adobe Flex Builder 4.6
- Latest sourcecode downloaded from google code

Please provide any additional information below.
Changes made to addEventListner and removeEventListner in StageWebViewBridge.as 
(see "// added EH 14-05-2012" ):

NOTICE: The file to download solves also issue #25.

import flash.events.ErrorEvent; // added EH 14-05-2012

override public function addEventListener( type : String, listener : Function, 
useCapture : Boolean = false, priority : int = 0, useWeakReference : Boolean = 
false ) : void
        {
            switch( type )
            {
                case Event.COMPLETE:
                case LocationChangeEvent.LOCATION_CHANGING:
                case LocationChangeEvent.LOCATION_CHANGE:
                case FocusEvent.FOCUS_IN:
                case FocusEvent.FOCUS_OUT:
                case ErrorEvent.ERROR: // added EH 14-05-2012   
                    _view.addEventListener( type, listener, useCapture, priority, useWeakReference );
                    break;
                default:
                    super.addEventListener( type, listener, useCapture, priority, useWeakReference );
                    break;
            }
        }

        /**
         * Overrides default removeEventListener behavior to proxy LOCATION_CHANGING events through the original StageWebView
         * This lets us to prevent the LOCATION_CHANGING event 
         */
        override public function removeEventListener( type : String, listener : Function, useCapture : Boolean = false ) : void
        {
            switch( type )
            {
                case Event.COMPLETE:
                case LocationChangeEvent.LOCATION_CHANGING:
                case LocationChangeEvent.LOCATION_CHANGE:
                case FocusEvent.FOCUS_IN:
                case FocusEvent.FOCUS_OUT:
                case ErrorEvent.ERROR: // added EH 14-05-2012   
                    _view.removeEventListener( type, listener, useCapture );
                    break;
                default:
                    super.removeEventListener( type, listener, useCapture );
                    break;
            }
        }

Original issue reported on code.google.com by streambu...@gmail.com on 14 May 2012 at 3:26

Attachments: