And here lies the trick

-keep-as3-metadata=Bindable,Managed,ChangeEvent,NonCommittingChangeEvent

You have to say what you want to show up..

Peace, Mike

On 6/8/07, Gordon Smith <[EMAIL PROTECTED]> wrote:

   Yes, you can define your own metadata and access it at runtime using
the describeType() function. However, by default the only metadata that is
compiled into the SWF is [Bindable], [Managed], [ChangeEvent],
[NonCommittingChangeEvent], and [Transient] (see the <keep-as3-metadata>
section in flex-config.xml) and you must change the default value of the
keep-as3-metadata option to include other metadata into the SWF.

As an example, compile the following application

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";>

    <mx:Script>
    <![CDATA[

        import flash.utils.describeType;

        [Foo(bar="baz")]
        public function doit():void
        {
        }

    ]]>
    </mx:Script>

    <mx:Button click="trace(describeType(this))"/>

</mx:Application>
with the option


-keep-as3-metadata=Bindable,Managed,ChangeEvent,NonCommittingChangeEvent,Transient,Foo
Click the button and inspect the trace output. You'll see
  <method name="doit" declaredBy="test1" returnType="void">
    <metadata name="Foo">
      <arg key="bar" value="baz"/>
    </metadata>
  </method>

Note: describeType() will only give you info about public APIs.

- Gordon

 ------------------------------
*From:* [email protected] [mailto:[EMAIL PROTECTED] *On
Behalf Of *Paul deCoursey
*Sent:* Friday, June 08, 2007 10:36 AM
*To:* [email protected]
*Subject:* [flexcoders] Metadata question

 Does anybody know if it's possible to define our own metadata and access
that info at runtime? For example, I'm writing a XML-Object binding
framework and I'd like to add some metadata to some generated classes
that I can access at runtime. The data I'd like to add is info about
how the object should be read or written to and from XML.

Paul




--
Teoti Graphix
http://www.teotigraphix.com

Blog - Flex2Components
http://www.flex2components.com

You can find more by solving the problem then by 'asking the question'.

Reply via email to