View Full Version : Error #1056, but only when used as an external swf???
maskedMan
07-16-2009, 02:32 AM
I'm putting together a loader and several external swfs to load into it. The swfs all compile and run fine on their own, but when I load the children into the loader swf I recieve this error message:
ReferenceError: Error #1056: Cannot create property endGame_btn on YourClass.
'endGame_btn' is a button I placed on stage in the flash IDE. That is the instance name I gave it. Obviously there is no problem when I publish the swf and test it on its own, so why does it give me an error when I load it into a container?
And how come I haven't ever had this happen before in the year or so I've been loading external swfs into a loader swf? :confused:
The 'solution' I found was to declare the class dynamic... but that isn't exactly the kind of 'solution' I want.
Mazoonist
07-16-2009, 02:52 AM
Hey maskedMan,
Is the button in question an instance of the Button component? If so, you may need to make sure the Button component is in the library of the SWF doing the loading.
Edit: If that's not the case, maybe you somehow changed your publish settings for "automatically declare stage instances" (?)
lordofduct
07-16-2009, 03:08 AM
sometimes I come across this issue when declaring library items to some class type inside a lower level package, and who links to a class written in a .as file and have objects in its displaylist being automatically declared.
Now of course you can turn "automatically declare stage instances" off.
But I found better is that make sure you make these classes "dynamic" as that is the root issue. Properties are being assigned to a class who's definition isn't allowing it.
public dynamic class YourClass extends SimpleButton
sadly I don't know why this doesn't happen all the time. And as I found it a long while back and have ALWAYS declared the namespace dynamic ever since for classes linked to library items... I haven't really seen the issue since and haven't really looked into the quarky randomness of it.
as for the "dynamic" thing "not being a solution". Really it is. It's exactly what allows the "declare all stage instances" thing to work. Both MovieClip and Sprite ARE dynamic classes. They are to allow this very action.
maskedMan
07-16-2009, 03:58 AM
Hmm... Maybe it does have something to do with having a reference to a class definition in my loader? That is something new, I think.
Mazoonist, It's not the Button component, but in fact just a plain SimpleButton. The existence of a SimpleButton with an instance name on the timeline of the child class is what causes the error. Also, I haven't touched the checkbox you're refering to so that isn't the source of the error.
Lordofduct, that's an interesting observation. I'm not sure it's that deep in this case, though. This is just a plain SimpleButton with an instance name sitting on the main timeline of a swf. BUT the document class of the loader swf has --
private var _external0:ExternalClass0;
private var _external1:ExternalClass1;
private var _external2:ExternalClass2;
When the external swfs are loaded, they are assigned to these variables. As I say, this is new for me. I wonder if the declarations here in the loader are the source of the error?
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.