    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="absolute"
        xmlns:v="views.*"
        backgroundColor="#000000"
        backgroundAlpha="0"
        creationComplete="initApp()" viewSourceURL="srcview/index.html">

        <mx:Style>
            global {
                color: #63769E;
            }
            .windowStyles {
                color: #ffffff;
            }
            ComboBox {
                fontWeight: normal;
                selection-color: #63769E;
                roll-over-color: #B5D2FA;
            }
            Button {
                fontWeight: normal;
            }
        </mx:Style>

        <mx:Script>
            <![CDATA[
                import mx.messaging.messages.AsyncMessage;
                import valueObjects.Order;
                import mx.rpc.events.FaultEvent;
                import mx.rpc.AsyncToken;
                import mx.controls.Alert;
                import valueObjects.Category;
                import events.PhotoEvent;
                import valueObjects.Photo;
                import mx.rpc.events.ResultEvent;
                import mx.collections.ArrayCollection;
                import events.OrderEvent;

                [Bindable]
                public var categoryData:ArrayCollection;
                [Bindable]
                private var photoData:ArrayCollection=new ArrayCollection();
                [Bindable]
                private var purchasedPhotos:ArrayCollection=new ArrayCollection();
                private var currentCategory:Category;

                private function categoryResultHandler(event:ResultEvent):void
                {
                    categoryData = event.result as ArrayCollection;
                }
                private function initApp():void
                {
                    photoRO.getAllPhotos();
                    categoryRO.getAllCategories()
                }
                private function photoSelectedHandler(event:PhotoEvent):void
                {
                    purchasedPhotos.addItem(event.selectedPhoto);
                }
                private function photoResultHandler(event:ResultEvent):void
                {
                    photoData=event.result as ArrayCollection;
                }
                private function checkoutHandler(event:OrderEvent):void
                {
                    var token:AsyncToken=orderRO.addNewOrder(event.order);
                    token.order=event.order;
                }
                private function orderResultHandler(event:ResultEvent):void
                {
                    var order:Order = event.token.order as Order;
                    order.orderNumber = event.result as int;

                    var message:AsyncMessage = new AsyncMessage();
                    message.headers.action="orderSubmitted";
                    message.body = order;
                    producer.send(message);

                    fStopContent.selectedChild=home;
                    purchasedPhotos.removeAll();
                    checkout.resetForm();
                    Alert.show("Your order has been placed as order #" + event.result);
                }
                private function photoUploadHandler(event:PhotoEvent):void
                {
                    var token:AsyncToken=photoRO.doCreate(event.selectedPhoto);
                    token.photo=event.selectedPhoto;
                }
                private function photoFaultHandler(event:FaultEvent):void
                {
                    Alert.show(event.fault.faultString, "Remote Object Fault");
                }
                private function photoCreateHandler(event:ResultEvent):void
                {
                    photoData.addItem(event.token.photo);
                    gallery.displayDetails(event.token.photo);
                    fStopContent.selectedChild=gallery;
                }
            ]]>
        </mx:Script>

        <mx:Producer id="producer"
             destination="photoDestination"/>

        <mx:RemoteObject id="categoryRO"
            destination="categoryService"
            result="categoryResultHandler(event)"/>

        <mx:RemoteObject id="photoRO"
            destination="photoService"
            fault="photoFaultHandler(event)">
            <mx:method name="getAllPhotos" result="photoResultHandler(event)"/>
            <mx:method name="doCreate" result="photoCreateHandler(event)"/>
        </mx:RemoteObject>

        <mx:RemoteObject id="orderRO"
            destination="orderService"
            result="orderResultHandler(event)"/>

        <mx:LinkBar
            dataProvider="{fStopContent}"
            color="#ffffff"
            x="101" y="5"
            rollOverColor="#B5D2FA" />

        <mx:Image
            y="30"
            x="101"
            source="assets/fstop/header.jpg" />

        <v:ShoppingCart
            x="626" y="118"
            purchasedPhotos="{purchasedPhotos}"
            checkout="fStopContent.selectedChild=checkout"/>

        <mx:ViewStack id="fStopContent"
            x="101" y="118"
            paddingBottom="0"
            paddingLeft="0"
            paddingRight="0"
            paddingTop="0"
            resizeToContent="true"
            creationPolicy="all">
            <v:Home id="home"
                label="Home" />
            <v:Contribute id="contribute"
                label="Contribute"
                categoryData="{categoryData}"
                photoUploaded="photoUploadHandler(event)"/>
            <v:Gallery id="gallery"
                label="Gallery"
                photoData="{photoData}"
                photoSelected="photoSelectedHandler(event)"
                categoryData="{categoryData}"/>
            <v:CheckOut id="checkout"
                label="Check Out"
                cartItems="{purchasedPhotos}"
                checkout="checkoutHandler(event)"/>
        </mx:ViewStack>

    </mx:Application>