actionscript 3 - Is there a way to truly extend a Flex component? -


i need create extension of flex component, (obviously) means new component should able used whenever parent used. don't see way it, flex offers 2 ways of extending component, defining class extending parent or creating mxml file uses parent component root element; in both cases can’t use nested elements configure child parent.

e. g.

package components { import mx.controls.advanceddatagrid;  public class fixeddatagrid extends advanceddatagrid {     public function fixeddatagrid() {         super();     } } } 

this valid mxml

 <mx:advanceddatagrid>  ...      <mx:columns>  ... 

this not valid mxml

<mx:fixeddatagrid> ... <mx:columns> ... 

it doesn't seem valid is-a relation.

when defining properties via new mxmltag, property must contain specified in same namespace tag.

so this:

<mycomp:fixeddatagrid columns="somearray"> 

without issues. if use mxml tag syntax define columns array property, need this:

<mycomp:fixeddatagrid >  <mycomp:columns>   <mx:advanceddatagridcolumn />   <mx:advanceddatagridcolumn />  </mycomp:columns> </mycomp:fixeddatagrid > 

columns property on advanceddatagrid, , therefore must defined in same namespace custom extension advanceddatagrid. advanceddatagridcolumn different component, definined in mx namespace.

as mentioned alternate poster, 'mycomp' namespace must defined in top level component of application. of time flash builder add namespace automatically you.


Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -