ReferenceError: Error #1056: Cannot create property on…

When you’re exporting an SWF associated with a document class file, you might have a few instances of MovieClips on the stage as well. These are acceptable as instance properties of your class even if they are not declared within it, by virtue of this checkbox:

Flash export settings

Like us, you might prefer to declare any such visual instances in the document class file, so you untick this checkbox and enter code such as the following in the class file:

Instance variables
private var image:MovieClip;

You compile the movie and receive the error:

ReferenceError: Error #1056: Cannot create property image on MyProject

The solution to this problem is to be sure that you declare the member as public, not private, in the instance declaration:

Instance variables
public var image:MovieClip;

Your SWF will then compile successfully and you’ll be able to reference the asset on the display list.

Comments on this post

  1. Sebastian says:

    Very good post, i had exactly the same problem. I’m glad that the solution ist that simple 🙂

Add a comment: