# Interface casting does not work

**URL:** <https://forum.kirupa.com/t/interface-casting-does-not-work/329855>\
**Category:** flash\
**Created:** [October 25, 2012, 12:48pm UTC](https://forum.kirupa.com/t/interface-casting-does-not-work/329855 "2012-10-25T12:48:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![GiGaGiG](https://avatars.discourse-cdn.com/v4/letter/g/a88e57/32.png) [@GiGaGiG](https://forum.kirupa.com/u/GiGaGiG)\
**Post date:** [October 25, 2012, 12:48pm UTC](https://forum.kirupa.com/t/interface-casting-does-not-work/329855/1 "2012-10-25T12:48:56Z")

</div>

Hi,  
I am having a problem with an interface:

I have

IAgent is an interface  
Agent implements IAgent

```auto
var iAgentContainer : IAgent;
iAgentContainer = new Agent();

```

I use this casting as I want to use only the functions defined in the interface, and I want to inhibit any other public item of Agent.

This works on the computers of 3 of the 4 programmers in our office.  
The 4th one receives a casting error:  
\*[Fault] exception, information=TypeError: Error #1034: Type Coercion failed: cannot convert com.Game::Agent@9250f21 to com.Game.IAgent.

\*The new Agent is instanced correctly, but when trying to cast it to IAgent it breaks the balls.  
Why?! Why does a PC behave in a different way with the same compiler (FlashDevelop), same SDK, same OS, same folder structure, same everything?
