Building components at runtime

View: New views
4 Messages — Rating Filter:   Alert me  

Building components at runtime

by Paul Sanders :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all

Thanks to the success of my first Flex application I've been asked to write a new one that is required to build the user interface from XML data it receives from a server. So the app sends a request to an HTTP Server and gets XML back that signifies such things as "username, string, maxlength=40; startdate, date and so on" from which the app would build a component and display it, capture values and send them back to the server.

So far all my (limited) Flex work has been MXML-specified user interfaces so I'd like to ask if people think this idea is hard to implement in ActionScript (I assume it's doable) and if there are any examples anywhere I could look at?

Thanks

Paul



Re: Building components at runtime

by Amy-28 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



--- In flexcoders@..., "prodanzr" <tendancer@...> wrote:
>
> Hi all
>
> Thanks to the success of my first Flex application I've been asked to write a new one that is required to build the user interface from XML data it receives from a server. So the app sends a request to an HTTP Server and gets XML back that signifies such things as "username, string, maxlength=40; startdate, date and so on" from which the app would build a component and display it, capture values and send them back to the server.
>
> So far all my (limited) Flex work has been MXML-specified user interfaces so I'd like to ask if people think this idea is hard to implement in ActionScript (I assume it's doable) and if there are any examples anywhere I could look at?

Check out
http://www.insideria.com/2009/10/dynamically-creating-classes-f.html
http://www.insideria.com/2009/10/interfaces-and-dynamic-class-i.html


RE: Building components at runtime

by Deepa Subramaniam :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This is definitely possible, and is essentially what Flash Builder's Design View does (FB's Design View is just a large Flex application) under the hood.

You will want to parse your XML and build up Flex objects at runtime (using the new operator), set properties on the objects based on the attribute values in the XML data (by setting properties directly, using setStyle() to set style attributes, etc) and add the newly created objects to the display list while mimicking the correct containment hierarchy.

I'll leave it up to knowledgeable folks on this list to point you to community/blogosphere resources.

deepa
Flex SDK Team

-----Original Message-----
From: flexcoders@... [mailto:flexcoders@...] On Behalf Of prodanzr
Sent: Wednesday, November 04, 2009 8:25 AM
To: flexcoders@...
Subject: [flexcoders] Building components at runtime

Hi all

Thanks to the success of my first Flex application I've been asked to write a new one that is required to build the user interface from XML data it receives from a server. So the app sends a request to an HTTP Server and gets XML back that signifies such things as "username, string, maxlength=40; startdate, date and so on" from which the app would build a component and display it, capture values and send them back to the server.

So far all my (limited) Flex work has been MXML-specified user interfaces so I'd like to ask if people think this idea is hard to implement in ActionScript (I assume it's doable) and if there are any examples anywhere I could look at?

Thanks

Paul




------------------------------------

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Alternative FAQ location: https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links




Re: Building components at runtime

by Fotis Chatzinikos :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

That is probably a bit over the top :-)

Check your data. If they are similar in structure and do not change (the
structure of the data, not the data) you can probably use a couple or
repeaters, lists, and so on...

On Wed, Nov 4, 2009 at 9:10 PM, Deepa Subramaniam <dsubrama@...>wrote:

>
>
> This is definitely possible, and is essentially what Flash Builder's Design
> View does (FB's Design View is just a large Flex application) under the
> hood.
>
> You will want to parse your XML and build up Flex objects at runtime (using
> the new operator), set properties on the objects based on the attribute
> values in the XML data (by setting properties directly, using setStyle() to
> set style attributes, etc) and add the newly created objects to the display
> list while mimicking the correct containment hierarchy.
>
> I'll leave it up to knowledgeable folks on this list to point you to
> community/blogosphere resources.
>
> deepa
> Flex SDK Team
>
> -----Original Message-----
> From: flexcoders@... <flexcoders%40yahoogroups.com> [mailto:
> flexcoders@... <flexcoders%40yahoogroups.com>] On Behalf Of
> prodanzr
> Sent: Wednesday, November 04, 2009 8:25 AM
> To: flexcoders@... <flexcoders%40yahoogroups.com>
> Subject: [flexcoders] Building components at runtime
>
> Hi all
>
> Thanks to the success of my first Flex application I've been asked to write
> a new one that is required to build the user interface from XML data it
> receives from a server. So the app sends a request to an HTTP Server and
> gets XML back that signifies such things as "username, string, maxlength=40;
> startdate, date and so on" from which the app would build a component and
> display it, capture values and send them back to the server.
>
> So far all my (limited) Flex work has been MXML-specified user interfaces
> so I'd like to ask if people think this idea is hard to implement in
> ActionScript (I assume it's doable) and if there are any examples anywhere I
> could look at?
>
> Thanks
>
> Paul
>
> ------------------------------------
>
>
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Alternative FAQ location:
> https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
> Search Archives:
> http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
> Links
>
>  
>



--
Fotis Chatzinikos, Ph.D.
Founder,
Phinnovation
Fotis.Chatzinikos@...,