Advertisement
crookedparadigm

ProjectApp.mxml

Apr 17th, 2012
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MXML 8.38 KB | None | 0 0
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
  3.                xmlns:s="library://ns.adobe.com/flex/spark"
  4.                xmlns:mx="library://ns.adobe.com/flex/mx"
  5.                xmlns:comps="comps.*"
  6.                minHeight="600" backgroundColor="#000000" creationComplete="main()"
  7.                currentState="Login"
  8.                width.Ginseng="955" height.Ginseng="600"
  9.                width.Login="955" height.Login="600" minWidth.Login="955"
  10.                width.Main="955" height.Main="600" minWidth.Main="955"
  11.                width.Menu="955" height.Menu="600" minWidth.Menu="955"
  12.                width.Splash="955" height.Splash="600" minWidth.Splash="955">
  13.     <s:states>
  14.         <s:State name="Login"/>
  15.         <s:State name="Splash"/>
  16.         <s:State name="Main"/>
  17.         <s:State name="Menu"/>
  18.         <s:State name="Ginseng"/>
  19.     </s:states>
  20.     <fx:Declarations>
  21.         <!-- Place non-visual elements (e.g., services, value objects) here -->
  22.     </fx:Declarations>
  23.    
  24.     <fx:Script>
  25.         <![CDATA[
  26.             import flash.media.Sound;
  27.            
  28.             import mx.collections.ArrayCollection;
  29.             import mx.collections.ArrayList;
  30.             import mx.controls.Alert;
  31.             import mx.effects.Tween;
  32.             import mx.events.ListEvent;
  33.            
  34.             import scripts.AlertSound;
  35.             import scripts.LabDataLoad;
  36.             import scripts.LabEQ;
  37.            
  38.             import spark.events.IndexChangeEvent;
  39.            
  40.             //[Bindable]
  41.             private var equipmentAC:Array = new Array();
  42.             private var equipmentXL:LabDataLoad;
  43.             private var equipmentList:ArrayList;
  44.            
  45.            
  46.             private function main():void
  47.             {
  48.                 trace("main fired");
  49.                 this.equipmentXL = new LabDataLoad("data/labEquipment.xml");
  50.                 trace("LabDataLoad instance created");
  51.                
  52.                 equipmentXL.addEventListener("XmlLoadedCompleteEvent", xmlCompleted);
  53.             }
  54.            
  55.             private function xmlCompleted(e:Event):void
  56.             {
  57.                 this.equipmentAC = this.equipmentXL.returnArray();
  58.                 equipmentList = new ArrayList(equipmentAC);
  59.                 this.eqViewList.dataProvider = equipmentList;
  60.                 this.eqDataList.dataProvider = equipmentList;
  61.             }
  62.             private function listChangeEvent(event:IndexChangeEvent):void
  63.             {
  64.                 var equipmentClicked:LabEQ = LabEQ(event.currentTarget.selectedItem);
  65.                
  66.                 this.viewTitle.text = equipmentClicked.title;
  67.                 this.labImg.source = equipmentClicked.imageURL;
  68.                 this.viewDescript.text = equipmentClicked.description;
  69.                 this.dataTitle.text = equipmentClicked.title;
  70.                 this.dataCategory.text = equipmentClicked.equipmentCategory;
  71.                 this.dataPurchase.text = equipmentClicked.yearOfPurchase;
  72.                 this.dataDescript.text = equipmentClicked.description;
  73.                 this.dataLife.text = equipmentClicked.averageHourlyLife;
  74.                 this.labThumb.source = equipmentClicked.imageThumbURL;
  75.             }
  76.            
  77.             private function cbFilterEvent (evt:Event):void
  78.             {
  79.                 var SelectedFilter:String = evt.currentTarget.selectedItem;
  80.                
  81.                 if(SelectedFilter == "ALL")
  82.                 {
  83.                     //Revert to original data provider
  84.                     this.eqViewList.dataProvider = equipmentList;
  85.                     this.eqDataList.dataProvider = equipmentList;
  86.                 }
  87.                 else
  88.                 {
  89.                     var newDataProvider:ArrayCollection = new ArrayCollection();
  90.                    
  91.                     for each (var tempEQ:LabEQ in this.equipmentAC)
  92.                     {
  93.                         //Declare if the selected filter is anything but ALL and populated field accordingly
  94.                         if(tempEQ.equipmentCategory == SelectedFilter)
  95.                         {
  96.                             newDataProvider.addItem(tempEQ);
  97.                         }
  98.                     }
  99.                     this.eqViewList.dataProvider = newDataProvider;
  100.                     this.eqDataList.dataProvider = newDataProvider;
  101.                 }
  102.             }      
  103.            
  104.         /*  protected function eqViewList_changeHandler(event:IndexChangeEvent):void
  105.             {
  106.                 // TODO Auto-generated method stub
  107.                
  108.             } */
  109.             private function tabClick (chatX:Number):void{
  110.                 if (chatX == 910){
  111.                     chatBox.chatPanel.alpha = 1.0;
  112.                     chatBox.x = 0;
  113.                 }
  114.                 else{
  115.                     chatBox.x = 910;
  116.                     chatBox.chatPanel.alpha = 0.0;
  117.                 }
  118.             }
  119.             public function gotIt():void{
  120.                 thermSWF.content.addEventListener("tempAlert", displayAlert);
  121.                 mapAlert();
  122.             }
  123.            
  124.             public function displayAlert(evt:Event):void{
  125.                 new AlertSound().play();
  126.                 alertBox.alpha = 1.0;
  127.                 alertBox.x = 227;
  128.                 alertBox.y = 108;
  129.             }
  130.             public function ginsengAlert():void {
  131.                 alertBox.alpha = 0.0;
  132.                 alertBox.x = -261;
  133.                 alertBox.y = 286;
  134.             }
  135.             public function mapAlert():void {
  136.                 ginsengMap.fOneSymbol.containerStyleName = "alertStyle";
  137.                 ginsengMap.fTwoSymbol.containerStyleName = "alertStyle";
  138.             }
  139.                
  140.            
  141.         ]]>
  142.     </fx:Script>
  143.  
  144.    
  145.     <s:Image id="bgLogin" includeIn="Login" x="0" y="0" source="assets/background.png"/>
  146.     <s:TextInput x="712" y="165" prompt="Username" includeIn="Login"/>
  147.     <s:TextInput x="712" y="214" prompt="Password" includeIn="Login"/>
  148.     <s:Button id="login_btn" x="770" y="262" label="Login" click="currentState='Splash'" includeIn="Login"/>
  149.    
  150.     <s:Image id="bgMain" includeIn="Main" x="0" y="0" source="assets/background.png"/>
  151.         <mx:ViewStack id="viewstack1" includeIn="Main" x="137" y="96" width="677"
  152.                       height="394">
  153.             <s:NavigatorContent id="eqView" width="100%" height="100%" label="Equipment Viewer">
  154.                 <s:Image id="labImg" x="218" y="26" width="250" height="250" />
  155.                 <s:TextArea id="viewDescript" x="127" y="312" width="423" height="72"/>
  156.                 <s:List id="eqViewList" x="31" y="76" height="167"
  157.                         change="listChangeEvent(event)"></s:List>
  158.                 <mx:ComboBox id="cboViewFilter" x="31" y="26" width="112" change="cbFilterEvent(event)">
  159.                     <mx:dataProvider>
  160.                         <fx:String>ALL</fx:String>
  161.                         <fx:String>Chemical Reaction</fx:String>
  162.                         <fx:String>Genetic Manipulation</fx:String>
  163.                         <fx:String>General Lab</fx:String>
  164.                     </mx:dataProvider>                 
  165.                 </mx:ComboBox>
  166.                 <s:TextArea id="viewTitle" x="247" y="280" height="24"/>
  167.             </s:NavigatorContent>
  168.             <s:NavigatorContent id="eqData" width="100%" height="100%" label="Equipment Data">
  169.                 <mx:VRule id="dataDivide" x="204" y="36" width="25" height="312"/>
  170.                 <s:List id="eqDataList" x="30" y="77" height="167"
  171.                         change="listChangeEvent(event)"></s:List>
  172.                 <mx:ComboBox id="cboDataFilter" x="30" y="36" width="112" change="cbFilterEvent(event)">
  173.                     <mx:dataProvider>
  174.                         <fx:String>ALL</fx:String>
  175.                         <fx:String>Chemical Reaction</fx:String>
  176.                         <fx:String>Genetic Manipulation</fx:String>
  177.                         <fx:String>General Lab</fx:String>
  178.                     </mx:dataProvider>                 
  179.                 </mx:ComboBox>
  180.                 <s:Image id="labThumb" x="251" y="36" width="75" height="75"/>
  181.                 <s:Label id="dataTitle" x="350" y="36" text="Label"/>
  182.                 <s:Label id="dataCategory" x="251" y="133" text="Label"/>
  183.                 <s:Label id="dataPurchase" x="251" y="168" text="Label"/>
  184.                 <s:Label id="dataLife" x="251" y="202" text="Label"/>
  185.                 <s:TextArea id="dataDescript" x="251" y="233" width="313" height="72"/>
  186.             </s:NavigatorContent>
  187.             <s:NavigatorContent id="maintCalender" width="100%" height="100%" label="Maintenance Calander">
  188.             </s:NavigatorContent>
  189.         </mx:ViewStack>
  190.         <mx:ToggleButtonBar id="toggleBar" includeIn="Main" x="137" y="71" width="679"
  191.                             dataProvider="{viewstack1}">
  192.         </mx:ToggleButtonBar>
  193.     <s:Image id="placeholder" includeIn="Splash" x="0" y="0" width="955" height="600"
  194.              source="assets/splash.png"/>
  195.     <s:Button id="placeholder_btn" includeIn="Splash" x="398" y="480" label="Imaginary Splash Screen"
  196.               click="currentState='Menu'"/>
  197.     <s:Image id="bgMenu" includeIn="Menu" x="1" y="1" source="assets/background.png"/>
  198.     <s:Image id="eqBtn" includeIn="Menu" x="88" y="64" source="assets/EqBtn.png" click="currentState='Main'"/>
  199.     <s:Image id="gsBtn" includeIn="Menu" x="498" y="64" source="assets/GsBtn.png" click="currentState='Ginseng'"/>
  200.     <s:Image id="bgGinseng" includeIn="Ginseng" x="-1" y="0" source="assets/background.png"/>
  201.     <s:SWFLoader id="thermSWF" includeIn="Ginseng" x="527" y="69" creationComplete="gotIt()"
  202.                  source="assets/Flashweatherservice.swf"/>
  203.     <s:Image id="alertBox" includeIn="Main, Menu" x="-261" y="286"
  204.              source="assets/alert.png" alpha="0" click="ginsengAlert, currentState='Ginseng'"/>
  205.     <comps:ChatUI id="chatBox" x="910" y="0" includeIn="Menu, Main, Ginseng" click="tabClick(chatBox.x)">
  206.     </comps:ChatUI>
  207.     <comps:ginsengMap id="ginsengMap" includeIn="Ginseng" x="57" y="162">
  208.     </comps:ginsengMap>
  209.     <s:Button id="gBackBtn" includeIn="Ginseng" x="27" y="561" label="Button" click="currentState='Menu'"/>
  210.     <s:Button id="menuBackBtn" includeIn="Menu" x="27" y="561" label="Button" click="currentState='Login'"/>
  211.     <s:Button id="mainBackBtn" includeIn="Main" x="27" y="561" label="Button" click="currentState='Menu'"/>
  212. </s:Application>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement