PDA

View Full Version : RIA: Bulding the initial GUI with MXML or AS3?


bjornbjorn
01-09-2007, 02:49 PM
Hi guys! Just to let you know I'm pretty new to Flash/AS so be gentle with me ;) .. my first introduction to the subject was FOTB06 and it surprised me how good AS3/Flex was.

Anyhow, on to the subject - I'm creating a pretty large enterprise application, and I'm wondering whether or not to use MXML.

I see the use for MXML - I think it's fun and easy to work with, and it's extremely fast to get something up and running quick.

However, coming from a Java world I'm used to the idea of classes and having a main class which inits all the others.

So, I searched this forum and I found this thread (http://www.actionscript.org/forums/showthread.php3?t=124589&page=2&highlight=applications) where madgett suggests this solution:


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" xmlns:app="app.*">
<app:Test />
</mx:Application>


Basically just a MXML file which inits Test

package app
{
public class Test
{
var window:TitleWindow = new TitleWindow();

addChild(window);
}
}


sidenote: why doesn't that TitleWindow above show??

.. but the posts who followed seemed kind of negative to that solution.

Any arguments for / against? What would people in here recommend for someone starting today - creating a large, scalable application?

- bjorn

Tink
01-09-2007, 03:07 PM
I recommend using MXML, if not your just fighting against Flex. The more experience you get with Flex the more you will know when to use and when not to use it.

However, coming from a Java world I'm used to the idea of classes and having a main class which inits all the others.This is the same with MXML, the object is just created and if its a DisplayObject, added to the displayList with MXML.

why doesn't that TitleWindow above show??It doesn't show because to add something to a DisplayList it need to be a DisplayObject (in Flex it at least need to be a UIComponent). As you can see your class just extends Object.

bjornbjorn
01-10-2007, 07:22 AM
Thanks for answering Tink :)

If you create an MXML application, how easy would it be to use the whole APP as a subsystem/module in another APP later (e.g. you click a button in the new app, and it changes state to the original MXML application).

It doesn't show because to add something to a DisplayList it need to be a DisplayObject (in Flex it at least need to be a UIComponent). As you can see your class just extends Object.

ah, ok thanks :-)

- bjorn

CDHBookingEdge
01-10-2007, 10:00 PM
Hi Bjorn, if you don't mind I have a couple of questions for you.

The standard way for a TitleWindow to show up is using the PopupManager. A TitleWindow is generally used as a dialog control, and is derived from a Panel Class. So I'm interested how you wanted it to work in the circumstance you presented. I'm not "complaining" LOL I'm just interested as it could prove enlightening. :D

As far as your last question:
If you create an MXML application, how easy would it be to use the whole APP as a subsystem/module in another APP later (e.g. you click a button in the new app, and it changes state to the original MXML application).


I/We are going to be doing a possibly hyper case of that in the near future for a project I'm working on. So A) I'll be listening intently as far as Tink's and other's responses and B) maybe have some quite interesting answers/examples for you.

If you're interested send me a private message and I'll be glad to keep you updated and maybe we can trade a few ideas back and forth :)

Christopher

bjornbjorn
01-11-2007, 07:21 AM
(...) So I'm interested how you wanted it to work in the circumstance you presented.
err... hey, I said I was new to this! :)

I'll send you a PM :)

- bjorn

CDHBookingEdge
01-11-2007, 12:03 PM
Not a problem. Heck, I consider myself new to the whole flex thing as well.
A titlewindow is used majorly as a dialog, at least to my knowledge and so that really would mean a kind of delayed viewing of it. So I didn't want that fact to hide some of the things you were trying to accomplish.

Here's the livedocs info that I'm basing this off of: http://livedocs.macromedia.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00000694.html

I'm sure, or at least I hope that Tink will let us know if I'm off base on what I said there.

Christopher

dr_zeus
01-11-2007, 05:38 PM
I would say that the TitleWindow will probably be used for pop-up dialogs (modal or non-modal) most often. However, it could certainly be used in situations where you want a static panel that can be closed or hidden.

CDHBookingEdge
01-11-2007, 05:43 PM
Thanks Josh, I kind of thought that way though most of the code I've seen seems to kind of override the Panel as the TitleWindow does its ownself.