Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
Adobe Flex SDK 4.1 (Release)
-
None
-
None
-
Affected OS(s): Windows
Affected OS(s): Windows XP
Browser: Internet Explorer 7.x
Language Found: English
Description
Steps to reproduce:
SDK 4 build 13875
Flash Builder 4.0.0.253292
I have created an application launcher which loads a swf subapplication with a SWFLoader:
var loaderContext:LoaderContext = new LoaderContext();
loaderContext.applicationDomain = new ApplicationDomain();
swfloader.loaderContext = loaderContext;
swfloader.loadForCompatibility = true;
swfloader.trustContent = false;
swfloader.source = subapp_path;
Actual Results:
The sub-application is loaded without problems but when using it I get the following error:
TypeError: Error #1034: Type Coercion failed: cannot convert mx.events::PropertyChangeEvent@f8adf29 to mx.events.PropertyChangeEvent.
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:12269]
...(stack traces in my code)...
I did not understand why a PropertyChangeEvent could not be converted in PropertyChangeEvent then I first thought that it has to do with multi-versioning problems, Application Domain, or Security Domaine of the loader. But after lot of modifications (config of the swf loader) the error still happened
As the origine of this error is in our code we had a closer look at it.
What we do there is to update a component which finally dispatches a PropertyChangeEvent like this:
var event:PropertyChangeEvent = new PropertyChangeEvent(PropertyChangeEvent.PROPERTY_CHANGE, true,true,PropertyChangeEventKind.UPDATE, "selected",oldValue, newValue, this);
dispatchEvent(event);
Workaround:
If I replace the event creation with the following ones the error does not happen anymore:
dispatchPropertyChangeEvent("selected", oldValue, newValue);
or
var event:PropertyChangeEvent = new PropertyChangeEvent(PropertyChangeEvent.PROPERTY_CHANGE,false,true,PropertyChangeEventKind.UPDATE, "selected", oldValue, newValue, this);
or
var event:PropertyChangeEvent = new PropertyChangeEvent(PropertyChangeEvent.PROPERTY_CHANGE,false, false,PropertyChangeEventKind.UPDATE, "selected", oldValue, newValue, this);
To sump up, the coercion problem does not appear when bubbles=false:
- the dispatchPropertyChangeEvent(..) method calls PropertyChangeEvent.createUpdateEvent(..) which creates a PropertyChangeEvent with bubbles set to false (default value)
- the two other solutions also create an event with bubbles=false
Thus it seems that the error comes from something dealing with bubble=true ?