Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Passing constructor parameters for MXML-based custom Flex components

I've implemented a MXML custom components and I would like to pass parameters to the constructor:

 newUser = new userComp("name");

instead of using set methods.

Is this possible if the custom components has been built in MXML (with initialize=myPseudoCostructor() method ?)

Or I can only set the parameter with an additional line of code?

like image 798
aneuryzm Avatar asked Apr 18 '10 17:04

aneuryzm


1 Answers

You can't pass variables into an MXML component's constructor. I don't even believe it's possible to define a constructor in an MXML component, though I could be wrong. You can, however, setup properties which have default values, and are changed post-construction.

You could also create an initialization function which is also invoked post-construction.

like image 100
bedwyr Avatar answered Oct 19 '22 14:10

bedwyr