keep-as3-metadata – But I never want to loose it!
First up its Easter weekend and I’m 5 beers to the wind on a lovely Easter Sunday so no poking fun at my gramer, ok.
I have recently been working on a project that required the External interface of the flash player, and seeing I have been playing with Metadata in AS3 I thought what better time. Simply put you call Externaliser.instance.externalise(this); Which (without terminator accent) externilises functions in that class with the metatdata [Externalise] placed above.
[Externalise (description="foo cummon"]
publif function foo():void{
// do Stuff
}
Cool, simple right. Well not quite. To keep metadata taging information available to use at runtime, in as3 you have to add the metadata tag name to the compiler settings: keep-as3-metadata Externalise.
But why? Apart from the standard metadata (ie [Bindable] etc) if I’m putting meta data into a class I would obviously want to keep it. And seeing we don’t have access to pre-processors in flex builder, im pretty sure the only time I would put metadata into a class would be to access it later on (over and above the standard metadata) at runtime. So I would like to see the change keep-as3-metadata change to loose-as3-metadata in the compiler in the next version and keep all non-standard as3 metadata by default.
So I will be placing a “bug” n the bugbase for flexbuilder 3 in hope of changing this.
In the mean time I will release the externalise class later on today (with source) so you can keep you externalisation quick and simple.
On a side note too I started work on an ActiveRecord implementation about 6 mnths ago, for AIR and SQLLite which uses the metadata tags heavily and after my current contract reaches it end I will be taking a week off, which should provie me time to clean this up for release. Stay tuned.
UPDATE: Added the issue in the bugbase HERE




Nice, I’m interested is this matter too so just send the bug url I’ll vote for it too.
Standing-by for the Externalise class
Adrian.
I’ve just build another usage of metadata example : http://ria-workshop.blogspot.com/2008/07/actions-framework-for-flex-part-3.html but this tricks with “keep-as3-metadata” are stupid – another thing to configure. Only 2 votes on JIRA
If you make Externaliser into a library project (to generate a swc for use in projects) then adding -keep-as3-metadata Externalise to the libraries compiler options will allow that tag to be kept in the projects that use the swc.
I wrote about it here and will be speaking on it at 360 Flex (among other topics)
http://jacwright.com/blog/72/using-your-own-custom-metadata-in-as3/
People won’t have to worry about adding any compiler options to use your swc. As long as it’s in Flex Builder 3. Hope that helps!
I will be using your Externalizer as an example of projects that use metadata in my 360 Flex presentation this next week. I hope you don’t mind. Also, with Flex Builder 3, if your SWC was compiled with the -keep-as3-metadata option, any project the SWC is used in don’t need to add it. It will be added automatically! Very useful, though I still agree they should just keep out certain ones as your bugbase issue states.