howdy,

i'm not sure what classes are defined in your modules or if you're using 
load-externs and external-library-path when compiling your module 
projects.  but what i have found is that if a module has a class linked 
in that is the exact same class (and comes from the same swc, say 
framework.swc) as another module, and you try to cast an object obtained 
from that module into the exact same class of another module then you 
will get a type coercion error.

so, my guess is that loading the shared content first loads the 
component into the "correct" applicationDomain.

to avoid guessing when to load what, use load-externs or 
external-library-path to so you can link in a component into a module 
when you know that the component is also linked from the code that 
loaded the module.  Specially if the modules have to "share" objects 
between each other.

alex harui's presentation of the class loading mechanism at 360flex was 
very helpful.

/r
http://www.searchcoders.com/flex/?applicationDomain+coercion
http://blog.searchcoders.com/


nxzone wrote:
> Why you think this bug is due to this cause? Why loading the shared
> content before should solve the "Type Coercion failed: cannot convert
> mx.controls::[EMAIL PROTECTED] to mx.controls.ButtonBar" ?
> 
> 
> --- In [email protected], "Alex Harui" <[EMAIL PROTECTED]> wrote:
>> Check out the shared code portion of my modules presentation at
>> blogs.adobe.com/aharui
>>
>> ________________________________
>>
>> From: [email protected] [mailto:[EMAIL PROTECTED] On
>> Behalf Of nxzone
>> Sent: Monday, March 26, 2007 2:27 PM
>> To: [email protected]
>> Subject: [flexcoders] Re: TypeError: Error #1034: Type Coercion failed :
>>
>>
>>
>> Same problem ...
>> Line 158 of ButtonBarButtonSkin.as... (parent.parent is a
>> ToggleButtonBar not a buttonbar)
>> var bar:ButtonBar = parent ? ButtonBar(parent.parent) : null;
>>
>> --- In [email protected] <mailto:flexcoders%40yahoogroups.com>
>> , "lrhazi" <lrhazi@> wrote:
>>> I get this annoying error often:
>>>
>>> TypeError: Error #1034: Type Coercion failed: cannot convert
>>> mx.controls::[EMAIL PROTECTED] to mx.controls.ButtonBar
>>>
>>> My app uses Modules and has a user login/logout functionality... I get
>>> the above error systematically when i logout of an account and login
>>> to a second one.
>>>
>>> Any hints on what to look for?
>>>
>>> Thank you very much.
>>> Mohamed~
>>>
> 
> 
> 
> 
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
> Yahoo! Groups Links
> 
> 
> 
> 

Reply via email to