[flexcoders] relationship of mxml child tags and actionscript

2009-04-15 Thread gwangdesign
Hi,

I am still looking for some general documentations about the guidelines as to 
how to write ActionScript custom components. It's clear that you can expose 
public properties, styles and event listeners of your custom components as MXML 
properties.

But what are the general rules if I want to allow my client developers to 
define a property in my custom component using a MXML child tag (as opposed to 
a property)?

Like this:

my:MyComp
   my:myChild color=0xFF width=300
  mx:Label text={data}/
   /my:myChild
/my:MyComp

Again, I am looking for _general_ guidelines. Thanks much.

-geng



Re: [flexcoders] relationship of mxml child tags and actionscript

2009-04-15 Thread Aaron Hardy
Geng,

Use the DefaultProperty metadata tag in your AS class.  Whatever 
property you specify will be the property to which your MXML children 
will be set.

Here's a start:
http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Book_Partsfile=metadata_141_07.html

Aaron

gwangdesign wrote:


 Hi,

 I am still looking for some general documentations about the 
 guidelines as to how to write ActionScript custom components. It's 
 clear that you can expose public properties, styles and event 
 listeners of your custom components as MXML properties.

 But what are the general rules if I want to allow my client developers 
 to define a property in my custom component using a MXML child tag (as 
 opposed to a property)?

 Like this:

 my:MyComp
 my:myChild color=0xFF width=300
 mx:Label text={data}/
 /my:myChild
 /my:MyComp

 Again, I am looking for _general_ guidelines. Thanks much.

 -geng