« First FUGN meet this season | Main | There she is!! »

ReferenceError: Error #1056: Cannot create property

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!)

A word from our sponsors :)

Comments

I think this issue is bad design from Adobe:it forces you to expose members, while they, as makers of the whole Flash thing should have been able to write some backdoor compile thing to set the private member.

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

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.

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 !!!!

Anonymous: then you probably should turn it off? :)

1is0: I love those animations of yours and the button sounds is a instant classic!

J

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!

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)