“Cannot create property” error in Flash

I just spent an hour trying to fix this error.  When I finally did, I realized it was a super easy problem and should have only taken 10 seconds to fix.  Hopefully this post helps some else out there…

The Setup

I’m editing a Flash file that was created by someone else (which is why I was blindsided by this issue).  All the ActionScript is in a number of class files….nothing fancy, though.  I added an image to the stage and converted it to a MovieClip.  Then I gave it an instance name since I was going to write a little code to control it.  As soon as I gave it an instance name, I got this nasty runtime error:

Keep in mind, I haven’t added/changed any ActionScript yet.  Giving it an instance name caused the error.  Without an instance name, everything worked fine.  I was in my morning haze, so a couple cups of coffee later, I remembered why this happens.

The Solution

You will get this error if Automatically declare stage instances is unchecked in your publish settings.  You can find this checkbox by going to File > Publish Settings > Flash and clicking the Settings… button next to ActionScript 3.0:

Checking this box will fix the issue. If you don’t have this box check, that mean you have to declare any instance names in your code:

Hope this helps!





Comments are closed.