<?xml version="1.0" encoding="utf-8"?>
<!--
 Flex 3 : Datagrid and filter by combobox
 
 By PhilFlash - http://philflash.inway.fr
 Initial version : March 2008
 
 . Flex Builder 3 Project Properties > Flex Compiler > Additional compiler arguments
   -locale=fr_FR,en_US -source-path=../locale/{locale}
 
 . icon from FamFamFam (http://www.famfamfam.com) and from Firefox

-->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" 
    applicationComplete="initApp()"
    layout="vertical" xmlns:dataservice="dataservice.*" xmlns:forms="forms.*" 
    viewSourceURL="srcview/index.html">
<mx:Style source="cssflex/dgcbfilter.css" />
<mx:Metadata>
    [ResourceBundle("myappli")]
</mx:Metadata> 
<mx:Script>
    <![CDATA[
        import events.GetCustomerEvent;
    
        private function initApp():void
        {
            dataSvc.getListCustomers();    
        }
        
        private function getPhpCustomers(event:GetCustomerEvent):void
        {
            dataSvc.getListCustomersWithPhp(event.max);    
        }
        
        private function setLangFr():void
        {
            resourceManager.localeChain = ["fr_FR"];
        }
        private function setLangEn():void
        {
            resourceManager.localeChain = ["en_US", "fr_FR"];
        }        
    ]]>
</mx:Script>
<dataservice:DataService id="dataSvc"/>
<mx:ApplicationControlBar width="100%">
    <mx:Label text="{resourceManager.getString('myappli','appli.title')}" styleName="applicationTitle"/>
    <mx:Spacer width="100%" />
    <mx:Image source="@Embed('/assets/flagfr.gif')" buttonMode="true" click="setLangFr()" 
        filters="{[new GlowFilter(0xFFFFFF, 0.9, 11, 11)]}" />
    <mx:Spacer width="5" />
    <mx:Image source="@Embed('/assets/flagenus.gif')" buttonMode="true" click="setLangEn()" 
        filters="{[new GlowFilter(0xFFFFFF, 0.9, 11, 11)]}" />
        <mx:Spacer width="10" />
</mx:ApplicationControlBar>
<mx:ViewStack id="mainView" width="100%" height="100%" creationPolicy="all">
    <forms:CustomerView id="customerView" getCustomers="getPhpCustomers(event)"/>
</mx:ViewStack>
</mx:Application>