Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Type Coercion failed for the same class

Tags:

apache-flex

I have a main application(app.swf) which loads a module(profiles.swf) and the profiles module loads another module(member_profile.swf). In member_profile I get member data from the server side where an object of type Member is returned. The object returned contains an array called Jobs holding objects of type MemberJob. In the member_profile module there's a function that takes a parameter of type MemberJob to display the job details. I have a loop that goes through the array returned and calls the function for each array item like this:

for(i = 0; i < member.Jobs.length; i++)
     addJob(member.Jobs[i]);

I am getting an error at the addJob line:

Type Coercion failed: cannot convert components.classes::MemberJob@19107d81 to components.classes.MemberJob.

And I receive this error always on the second loading of the member_profile module. I mean this module gets loaded when I click a member's name from the profiles module which passes this name as the parameter for the sub module to load the profile of that member including his jobs. So if I chose to see the profile of member "X" the profile is loaded without any errors but if I then click on member "Y" (which causes the sub module to be reloaded with the new parameter) then I get the type coercion error. And if I did the opposite click on "Y" first then "X" the same happens, error in the second load.

Can anyone help me on this?

like image 273
Yasmine Avatar asked Jan 21 '23 20:01

Yasmine


1 Answers

Re-read the Flex Help section on Module Domains and make sure that you've imported the components.classes::MemberJob class into the correct domain.

EDIT:

Try putting the following somewhere in your main application file and see if it makes a difference:

import components.classes.MemberJob;
private var memberJob:MemberJob;
like image 124
Ryan Lynch Avatar answered Jan 24 '23 08:01

Ryan Lynch