Aravinth
Aravinth

Reputation: 363

Flex Dynamic Component runtime Creation

I jus Want to know, how could be possible to create Dynamic Components in Flex run Time.

For eg: creating a combo box with change Handler Dynamically, text box Dynamically,

Now, the value of combo box and textbox should place in a VO Class and the VO class also to be created Dynamically,

user have to provide how many fields they need and wat are the components needed and according to tat Dynamic VO has to Create in run Time,

Hope This is clear, kindly suggest me a Example, Thankxxx in Advance

Upvotes: 1

Views: 704

Answers (1)

Mahesh Parate
Mahesh Parate

Reputation: 786

To create Dynamic class is tricky.

As per your requirement you want some combo box with change Handler, text box, etc. Once you know what component you have to display according to vo which is been created dynamically.

You can create One custom component which contains your all required component (i.e. combo box, , text box, etc. )

or

Can create different custom component. Selection is yours.

There should be one parameter/condition, which will decide which component should be displayed at run time. Like adding switch case or your own logic.

While creating combo box you can add addEventListner in actionscript to handle change even and can dispatch custom event or can perform your defined operation.

In the same way you can addEventlistner to your custom component (ex. – text box, checkbox, etc.).

There should be unique key for all if user want to create combo box unique key should be 1(sample/any dynamic value can be retrived from VO), text box unique key should be 2, etc…. it will help you while creating dynamic component.

Make sure while creating component you have to use concept of set and get method for passing parameter.

Create only required component by using proper Flex component life cycle.

Hope this may help you bit as rough understanding.. or can search for better approach..

Upvotes: 1

Related Questions