View Full Version : Best Practice: When to use mxml and when to use AS?
phirstube
10-10-2008, 08:55 PM
What are your thoughts on this? Can anyone provide insight on when to use ActionScript as opposed to MXML or visa versa?
Rossman
10-10-2008, 09:34 PM
MXML = Flex
AS = Flash and Flex
If you only have Flash CS3 you can never use MXML.
Peter Cowling
10-10-2008, 11:37 PM
If you are developing through the Flex framework, you use AS when the standard components do not suit your requirements - presentational, performance, or whatever-wise.
In getting started with flex its more important to take into account the coder's background: if it more designer oriented, probably best start off with MXML; developers may find it best to concentrate on AS.
The Brow
10-10-2008, 11:52 PM
I started with pure MXML and then gradually changed almost everything to AS3 when it wouldn't run on Firefox. Just my personal experience. I access plenty of Flex objects, but use the programmatic syntax of AS3 as opposed to the declarative syntax of MXML. With the latter, you obviously have less control as you're telling flash (or whatever) "Just do everything for me." You would have to think this would have a negative impact on memory usage and efficiency in general.
wvxvw
10-11-2008, 12:07 AM
MXML is indispensable when it comes to automatic creation of SWFs on the server. Look at it like this: MXML is rather a markup language, more like HTML + JS that allows you for automatization of creating patterned content.
Imagine this situation: you have a ready PHP / ASPX blogging engine which you want to skin with Flash. You can write the AS engine that'd load all the contents part by part from different sources, having multiple preloaders and sophisticated loading / security and content management system, and, on the other hand you may just use something like PEAR XML_MXML library to generate binary files that already include all the stuff you need based on the very basic input, thus you'll significantly lower the load on your server (you'll need to load only compressed binaries having to post a simple request, rather than posting huge amounts of data back and forth just to figure out what do you need to load).
BTW. Just to make it clear: MXML in general has very little connection to the Flex (mx) framework, you're not obliged to use it with mx components. It is just another language, that the mxmlc compiler can understand. It must use something like 5 classes that are not connected directly to the mx framework, which being compiled will take no more than some 0.5K.
Peter Cowling
10-11-2008, 10:22 PM
BTW. Just to make it clear: MXML in general has very little connection to the Flex (mx) framework, you're not obliged to use it with mx components. It is just another language, that the mxmlc compiler can understand. It must use something like 5 classes that are not connected directly to the mx framework, which being compiled will take no more than some 0.5K.
Significantly good 'BTW'.
phirstube
10-13-2008, 08:23 PM
A co-worker had this response and I think it makes quite a bit of sense.
"Use an MXML file to layout the major GUI components of your application. Use ActionScript to create derived and custom GUI components, and just about everything else.
Corollary: Use an MXML file and the Script tag only for trivial programs and sample code."
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.