Flex Skin Design Extension for Flash CS3 ReferenceError 1056 Workaround
This week while writing a tutorial for the Flash-Flex Integration series, I came across this very strange error whenever I tried compiling my Flex project using a skin which had a boundingBox clip on the timeline, using a Button skin template in the Flex Skin Design Extension for Flash CS3:
at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
at flash.display::MovieClip()
at mx.flash::UIMovieClip()[E:\dev\trunk\frameworks\projects\flash-integration\src\mx\flash\UIMovieClip.as:467]
...
Unfortunately this error occurs whenever you place any kind of MovieClip (and I suspect any non-drawing object as well) on the timeline.
The solution, it would seem, is to simply declare the object on the skin timeline:
Which seems very odd to me, given that UIMovieClip is a dynamic class.
Just to verify for myself that this was true, I placed the following code on the timeline:
- import flash.utils.*;
- trace("class: "+describeType(this).@name+"\nextends: "+describeType(this).@base+"\nis dynamic: "+describeType(this).@isDynamic);
Which, sure enough, returned
extends: mx.flash::UIMovieClip
is dynamic: true
This is very puzzling to me. I’ve logged a bug on the Adobe JIRA bugbase. I’m hoping they patch it soon or release a technote; people using the extension should be aware of this issue, or much tearing-out-of-hair may ensue.
Update 2008-04-18: Just discovered that Jesse has found the same bug, and it’s not really a bug but a quirk of the Flash compiler not automatically declaring class instances on the stage.
My guess is that this error is appearing because normally when you associate a class linkage with a MovieClip in the library, you need to declare your stage instances, as automatic stage object declaration is turned off. Same here, except the class associated with that container is UIMovieClip, which is not a custom class where you can place your object definitions. I still think there needs to be a mention in the FCK documentation about this.
As soon as I saw Jesse’s post I smacked myself in the head proclaiming “Of course!”
Some weeks are just like that.