<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" 
    xmlns:view="view.*" 
    layout="vertical" 
    horizontalAlign="left"
    initialize="myService.send()">
    
    <mx:Script>
        <![CDATA[
        
            import mx.rpc.events.*;
            import mx.collections.ArrayCollection;
            import mx.controls.Alert;
            
            [Bindable]
            public var specials:ArrayCollection=new ArrayCollection();
        
            private function resultHandler( event:ResultEvent ):void {
                specials = event.result.specials.menu_item;
            }
            
            private function faultHandler(event:FaultEvent):void {
                Alert.show(event.fault.faultString, "Error Message");
            }
            
        ]]>
    </mx:Script>
    
    <mx:HTTPService id="myService"
        url="http://127.0.0.1:8700/flex/lcdsIntro/data/specials.xml"
        result="resultHandler(event)"
        fault="faultHandler(event)"
        useProxy="true"/>

    <mx:Image id="headerImage"
        source="@Embed('./images/header.jpg')"/>
    
    <mx:Label text="This Week's Specials" 
        fontSize="14"
        fontWeight="bold"/>

    <view:SpecialsDisplay 
        dataProvider="{specials}" 
        width="{headerImage.width}"/>
    
</mx:Application>
