This content has been marked as final. Show 3 replies
If you want to instantiate your custom component you are goign to want to create it dynamically in actionscript:
var myComp:MyCustomComponent = new MyCustomComponent();
var myComp2:MyCustomComponent = new MyCustomComponent();
If you want to be able to refer to them from other functions you can declare them public.
Simply declaring a public property inside your custom component (either a public var or public get/set methods) will allow you to pass additional data to your component. Put the variables in an <mx:Script /> block if it's an MXML component. Again, make sure they are public or have public getter/setter methods.
jmryan's suggestion is the preferred way to go. This way you can use the simple MXML syntax that you described in your post.
If your custom component is defined in ActionScript, you can use setters or the creationComplete event to update the component when the values are passed in from the tag (they are set *after* your constructor runs).
Even easier, if your component is defined in MXML, you can add [Bindable] to your public field and then bind directly to it in the custom component's MXML code.