Hi Harry,

This is so you can instantiate and populate your class in MXML?

I don't think you have to do anything special. Just define public properties or accessor methods on your class. You can then instantiate your class in MXML, setting the value of properties with child elements. For instance, if your class looks like this:

public class MyClass
{
        public var name:String;
        public var children:Array;
}

You can then say:

<MyClass>
        <name>A string</name>
        <children>
                <mx:String>Some other objects here</mx:String?>
                <mx:String>Or whatever else you want to put here</mx:String?>
        </children>
</MyClass>

Does that answer your question?

Cheers,
Lach

On 09/12/2006, at 10:33 AM, Du, Xiaochen ((Harry)) wrote:

Hello all,

I want to create a non-visual component that can have another non- visual component as child.
For example:
<MyComponentA>
<MyComponentB/>
</MyComponentA>

How to do that?

I know I should implement the AS class of MyComponentA from IMXMLObject like the following. But I don't know how to make it enable to accept another non-visual component as child.

public class MyComponentA implements IMXMLObject
{
public function initialized(document:Object, id:String):void
{
trace(id);
trace(document);
}
}

You help is highly appreciated.

Regards,
Harry

Reply via email to