Custom Metadata in AS3.0 Class Definition
For the past month or so I have been spending the odd evening porting a well known Java based dependency injection framework to ActionScript 3.0. Integral to this port is the ability to bind framework specific metadata to class members and for the runtime interpreting of this meta.Thankfully the AS3.0 compiler provides a compiler option to retain meta bound to class members. Namely:
This option will retain any meta bound to class members for runtime examination through the class xml definition.
Now for the bugs.
The first annoying but not so serious one I have discovered is the lack of support for binding metadata to a class constructor. All other members will retain their meta, but a constructor seems not carry its meta into the class definition. To get around this I bind constructor specific meta at the class level.
The second is a critical bug which stopped me dead in my tracks. It appears that this metadata is only carried into the class definition when building in debug mode. In a production built swf, the compiler strips this data out so you are unable to examine it at runtime.
For my current project I intend to support both an internal and external DSL, so this issue is not so much a show stopper than a redundantly supported feature.
I should state that I am testing using the Flex 2 SDK, I will do some further tests with the Flex 3 beta SDK to see if either of these issues have been fixed.
[UPDATE]
OK so I’ve done some quick testing with the Flex 3 SDK and it’s looking positive. The major issue of carrying meta into production swfs has been fixed which is great news.
On the issue of binding meta to a class constructor it appears that this has not been solved. Of course this may be an underlying Flash Player bug but if not, then fingers crossed the final v3 SDK will rectify this.
About this entry
You’re currently reading “Custom Metadata in AS3.0 Class Definition,” an entry on Mike Stead
- Published:
- 10.03.07 / 10am
- Category:
- ActionScript 3.0
Comments are closed
Comments are currently closed on this entry.