ReferenceError: Error #1056: Cannot create property

02 Sep

Quite often, I do projects where I do the code and somebody else do the graphics. I usually set this up so that the designer can work in Flash CS3, whereas I do my code in Flex Builder. I set my class to be the Document Class and then set the FLA to not “Automatically declare stage instances” so I can reference the animators MovieClips inside my code.

Today I got an error that I’ve also gotten on a couple other occasions and I thought I’d blog the solution here for future reference.

This is the error:

ReferenceError: Error #1056: Cannot create property anim1 on Bynett.
	at flash.display::Sprite/constructChildren()
	at flash.display::Sprite()
	at Bynett()

By default, I usually set all properties in a class to “private”. This error will occur if you set a MovieClip to “private” when it should have been “public”. What happens is that since the MovieClip is set to private, the Flash CS3 environment won’t have the required access to this clip. Just make sure that all objects that the designer will control is set to “public” and all is fine.

(Thanks to Kadazuro for reminding me of the solution!)

02 September 2008 at 8:41 pm

10 Responses to ReferenceError: Error #1056: Cannot create property

  1. avatar photo
    Macaca 07 September 2008 at 4:38 pm #
  2. avatar photo
    Jim 11 September 2008 at 3:58 am #

    Another reason this error can show up is if you have “Automatically declare stage instances” turned off in your AS settings.

  3. avatar photo
    0 12 September 2008 at 12:06 pm #

    Weird, I’m getting this error but the instance is public and “Automatically detect stage instances” is turned on.

    It seems to be caused by a dynamic textfield inside it which was created in the Flash IDE. I figured maybe I needed to declare it as a property of the class, but then Flash tells me it can’t be declared twice. I’m stumped.

  4. avatar photo
    1is0 14 September 2008 at 8:41 am #

    This post helped me. I got the 1056 error and your post made me understand the problem was that for some reason I didn`t have the “Automatically declare stage instances” checkbox in the publish settings enabled (as it should be by default).
    Thank you !!!!

  5. avatar photo
    Jensa 14 September 2008 at 7:29 pm #

    J

  6. avatar photo
    Erika 19 October 2008 at 8:32 am #

    I was almost crazy with this 1056 error, I turned on the “Automatically declare stage instances” from publish settings and it finally works! Thanks guys!

  7. avatar photo
    antoniobrandao 05 January 2009 at 10:03 pm #

    it also happens if you have a layer turned “invisible” in the Flash CS4 IDE. It doesn’t even compile the contents of the layer and returns this same error

  8. avatar photo
    petran 22 December 2009 at 9:49 pm #

    I had the same problem , I also turned the “Automatically declare stage instances”, but now I am creating new movie clips then dragging them in to my mp3 player movieclip giving the instance name but can not access them from the mp3 player class.

  9. avatar photo
    petran 22 December 2009 at 10:01 pm #

    I am tracing getChildAt and is working it gives me the movieclip’s instance name but when I am using this name to refer to it gives me access off possibly undefined property error. Thanks.

  10. avatar photo
    Jam 02 January 2011 at 2:16 am #

    Thanks. I never thought to look at the publish settings. Haha.

  11.