We’ve come across this error several times during the development of our last few games. The error occurs when compiling from Flash Develop. The error can usually be side-stepped by cleaning and then building (SHIFT+F8, F5), but this can be a hassle, and it’s always nice to try to remove these errors entirely.
According to others who have had the issue there can be many causes for this error. However, in our case, the error related to the naming of symbols within a swc file included in the project.
It seems if any two (or more) symbols on the same timeline have the same instance name, this error will occur. For example, if you add a MovieClip to the stage and name it ‘clip1’, then copy and paste it, both of these symbols will have the same instance name of ‘clip1’. It doesn’t matter if they are both on the same frame, or if they are on different frames of the same timeline – if you now include this as a swc to your FlashDevelop project you will likely get the contract violation error.
This works for any timeline, not just the stage – so be careful about all your nested MovieClips. For example, if you add a MovieClip to the stage, and then within that MovieClip you have two symbols with the same name you will also get the error.
In our case the culprit was a button MovieClip with 2 frames – a ‘normal’ frame and a ‘pressed’ frame. On both frames the background of the button was called ‘bg_clip’.