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: 1,080
Comments: 1 Comment

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.

Social bookmarks
  • Digg
  • Twitter
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • email
  • Reddit
  • StumbleUpon
  • LinkedIn
  • Print
Rate this post
1 star2 stars3 stars4 stars5 stars   (4 votes, average: 3.50 out of 5)
Lenovo Microsoft Adobe Heart Internet Envirowise
Copyright © 2008 Orland Media Ltd | All rights reserved Company details Ethical policy Terms & conditions Privacy policy