1
votes

I'm trying to get the DefaultProperty metadata for a class in ActionScript but I can't find any mention of the DefaultProperty in the metadata XML.

I'm using the following code:

var describedTypeRecord:DescribeTypeCacheRecord = mx.utils.DescribeTypeCache.describeType(BorderContainer);
var typeDescription:* = describedTypeRecord.typeDescription;

The XML is long but here the first node it returns:

<type name="spark.components::BorderContainer" base="spark.components::SkinnableContainer" isDynamic="false" isFinal="false" isStatic="false">

The default property for BorderContainer or SkinnableContainer is mxmlContentFactory:

[DefaultProperty("mxmlContentFactory")]

I've also tried RichText. The default property for this is "content":

[DefaultProperty("content")]

It doesn't seem to show anything about it in the metadata.

In the compiler options I have included the compiler arguments:

-keep-as3-metadata+=DefaultProperty
1
I am getting defaultProperty metadatatag for Richtext. <metadata name="DefaultProperty"> <arg key="" value="content"/> </metadata> mxmlContentFactory is DefaultProperty for SkinnableContainer and it is showing it in the generated xml for SkinnableContainer but not for BorderContainer - Sumit
Yeah. Sometimes they are declared on super classes. I had to walk the parent classes and check each one to find it. - 1.21 gigawatts

1 Answers

0
votes

It is not set on some classes but if it is defined it will be defined on the super classes.

I was checking BorderContainer but it was defined on a SkinnableContainer:

<metadata name="DefaultProperty">
  <arg key="" value="mxmlContentFactory"/>
</metadata>

The code I have posted works when it's defined on the main class. If a class doesn't have a default property I would get a list of all the super classes and check each one until I got to object or UIComponent.