About Orland MediaDevelopmentTrainingBlogRSS FeedContact us
Microphone

ReferenceError: Error #1056: Cannot create property on…

Date: Friday 12th December 2008
Time: 14:06
Category: ActionScript 3.0
Views: 28
Comments: No comments

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.

Rate this post
1 Bar2 Bars3 Bars4 Bars5 Bars   (Roll over and click)
Reply

Lenovo Microsoft Adobe Demon Envirowise
Copyright © 2008 Orland Media Ltd | All rights reserved Company details Ethical policy Terms & conditions Privacy policy