Hi,
I am having a very weird problem, and my colleagues are stuck because of this. I say "my colleagues because some of them, not all, cannot execute it: they can compile my code, but when executed it returns an error that me and other colleagues do not receive.
TypeError: Error #1034: Type Coercion failed: cannot convert bla.bla.bla::Agent@43d41f1 to bla.bla.bla.AgentBase
in class AgentManager
I can’t extract a working piece of code, it is very complex, but I will try to show you how it works.
I have this structure:
IAgent (interface) extends IAgentBase (interface).
Agent extends AgentBase.
AgentBase implements IAgentBase.
Agent implements IAgent.
AgentManager extends AgentManagerBase.
AgentManagerBase has property
public var iAgentContainer : IAgentBase;
AgentManager instances an object (an external SWF) of type Agent (specific for each application) and assigns it to iAgentContainer.
iAgentContainer = assetsLoader.instancePlugIn("agentPlugIn");
that returns an object of type “Agent” (the SWF is loaded by Greensock SWFLoader).
It looks like doing
public var iAgentContainer : IAgentBase;
iAgentContainer = new Agent();
that should be the correct way of using interfaces. Anyway, as I declared iAgentContainer as IAgentBase in AgentManagerBase I could only use AgentBase methods, not Agent ones, but I can use them by casting iAgentContainer to the specific Agent.
Now the situation is ridiculous, as I am explaining this as if it was a bug or something, but I can compile and execute, while some others can’t!
The API (FlashDevelop) is the same, the FlashPlayer is the same, the SDK is the same, the source is the same (aligned with SVN). We tried to format and reinstall everything too, but with no success. A colleague that previously could compile and execute (at home) now can compile but execute with errors, from day to day. It looks like a machine-dependent problem, but why does it work on a machine and the day after it doesn’t work anymore?
I have no clue of what the problem could be, any suggestion is really appreciated!