[flexcoders] Strange type-coercion error message! Ideas?
*TypeError: Error #1034: Type Coercion failed: cannot convert Tools.dal.dataObjects::datainvestmentallocat...@2d28301 to Tools.dal.dataObjects.dataInvestmentAllocation.* This one has me a little stumped! The client's project is modular, and has a 'global' array of data objects. They access them a bit like this: *var dataIA:dataInvestmentAllocation = Application.application._dataCollection.DataObjectGet(investmentAllocation); * Every other object works in the same way without issues. In fact I'm fetching two data objects without issues directly before this. The object I'm getting is in the array of objects, is of type *dataInvestmentAllocation (excuse the casing!)* and there is only one in the array, yet the error message seems to append an instance id to the type (?!). The only difference I can see is that with this object, it was created and added to the collection in the previous module (but as I said, it's there in the array, and it's put there way before I try to access it in the next module) Can anyone shed any light on this?
Re: [flexcoders] Strange type-coercion error message! Ideas?
Looks like your objects belong to different ApplicationDomains. By which I mean - object 1 is created from a class called Tools.dal.dataObjects.dataInvestmentAllocation defined by module 1, and object 2 is created from a class called Tools.dal.dataObjects.dataInvestmentAllocation defined by module 2. As far as Flex knows, they are _different classes_, because they are defined in different ApplicationDomains. To fix this, make sure your module loading code passes ApplicationDomain.currentDomain, so the modules all share the same definition space. Hope that helps, Ian On Wed, Aug 12, 2009 at 9:49 AM, nwebbneilw...@gmail.com wrote: TypeError: Error #1034: Type Coercion failed: cannot convert Tools.dal.dataObjects::datainvestmentallocat...@2d28301 to Tools.dal.dataObjects.dataInvestmentAllocation. This one has me a little stumped! The client's project is modular, and has a 'global' array of data objects. They access them a bit like this: var dataIA:dataInvestmentAllocation = Application.application._dataCollection.DataObjectGet(investmentAllocation); Every other object works in the same way without issues. In fact I'm fetching two data objects without issues directly before this. The object I'm getting is in the array of objects, is of type dataInvestmentAllocation (excuse the casing!) and there is only one in the array, yet the error message seems to append an instance id to the type (?!). The only difference I can see is that with this object, it was created and added to the collection in the previous module (but as I said, it's there in the array, and it's put there way before I try to access it in the next module) Can anyone shed any light on this?
Re: [flexcoders] Strange type-coercion error message! Ideas?
Ian, you are an absolute star! Thank you so much. I get the feeling I could have been going round in circles over this one. For anyone searching these threads, just to clarify, the solution was to add the second line of code as shown below: _mainModuleLoader = new NoviaModuleLoader(); _mainModuleLoader.applicationDomain = new ApplicationDomain(ApplicationDomain.currentDomain); Cheers, Neil On Wed, Aug 12, 2009 at 9:54 AM, Ian Thomas i...@eirias.net wrote: Looks like your objects belong to different ApplicationDomains. By which I mean - object 1 is created from a class called Tools.dal.dataObjects.dataInvestmentAllocation defined by module 1, and object 2 is created from a class called Tools.dal.dataObjects.dataInvestmentAllocation defined by module 2. As far as Flex knows, they are _different classes_, because they are defined in different ApplicationDomains. To fix this, make sure your module loading code passes ApplicationDomain.currentDomain, so the modules all share the same definition space. Hope that helps, Ian On Wed, Aug 12, 2009 at 9:49 AM, nwebbneilw...@gmail.comneilwebb%40gmail.com wrote: TypeError: Error #1034: Type Coercion failed: cannot convert Tools.dal.dataObjects::datainvestmentallocat...@2d28301 to Tools.dal.dataObjects.dataInvestmentAllocation. This one has me a little stumped! The client's project is modular, and has a 'global' array of data objects. They access them a bit like this: var dataIA:dataInvestmentAllocation = Application.application._dataCollection.DataObjectGet(investmentAllocation); Every other object works in the same way without issues. In fact I'm fetching two data objects without issues directly before this. The object I'm getting is in the array of objects, is of type dataInvestmentAllocation (excuse the casing!) and there is only one in the array, yet the error message seems to append an instance id to the type (?!). The only difference I can see is that with this object, it was created and added to the collection in the previous module (but as I said, it's there in the array, and it's put there way before I try to access it in the next module) Can anyone shed any light on this?