I had a particularly sticky flash problem where a MovieClip worked perfectly when run on its own, but when loaded into a container clip using a loader, would give:
Error #1056: Cannot create property someProperty on loaded clip myLoadedClip
At first I thought it was some kind of timing problem or failure to declare the items in the clip, but it turned out, simply adding the word dynamic to the class definition fixed the problem. Dynamic classes can have properties added at runtime. The MovieClip class is already dynamic, but apparently, the dynamic property is removed in some other part of my code.
Ads by Google
Posted by ellen at October 31, 2008 05:26 PM
So in the example below showing the opening lines of a class declaration, I've highlighted the added "dynamic" in red.
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*; //for timer
import flash.text.*;
import flash.net.*
import flash.xml.*
import ToolTip;
import cart;
import drawerHandle;
import stopDragEvent;
public dynamic class drawer extends MovieClip
{
etc. . . .
Many thanks to Flep of flepstudio for this article which helped solve the problem.
Ads by Google
Thank you so much for this. I can't tell you how many other ways I tried to fix this. I could test the offending fla and document class apart from my main application just fine. When I went to add the resulting swf to my main application and look after event listeners, it started through this error.
Thanks!
We had the Same problem here. Solution was:
The class thet presented the problem was also in the library of the preloader. After removing it from there, everything was funky.
byez.
Gut!
I had this problem recently. I have one flash file that loads another. As soon as I imported the class definition of the child file into the parent this error popped up. Even though I don't like the idea of using dynamic classes, the only way I could work around the issue was to designate the child class as a dynamic one.
Thanks for this... had no idea!
Example of the code before and after? TOTAL NEWB!!!
Sorry, you're right. I'm adding it to the article.
Thank you! I found this on my first Google search and it fixed my issue!
Thank you very much.
If you type 'dynamic' in class deceleration there may be problems in importing other 3rd party classes. Most probably, the problem is in settings. There is a check box at Publish settings >> ActionScript 3.0 >> Automatically declare stage instances. Enable this. This will fix it.