Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="utf-8"?>
- <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:s="library://ns.adobe.com/flex/spark"
- xmlns:mx="library://ns.adobe.com/flex/mx"
- xmlns:comps="comps.*"
- minHeight="600" backgroundColor="#000000" creationComplete="main()"
- currentState="Login"
- width.Ginseng="955" height.Ginseng="600"
- width.Login="955" height.Login="600" minWidth.Login="955"
- width.Main="955" height.Main="600" minWidth.Main="955"
- width.Menu="955" height.Menu="600" minWidth.Menu="955"
- width.Splash="955" height.Splash="600" minWidth.Splash="955">
- <s:states>
- <s:State name="Login"/>
- <s:State name="Splash"/>
- <s:State name="Main"/>
- <s:State name="Menu"/>
- <s:State name="Ginseng"/>
- </s:states>
- <fx:Declarations>
- <!-- Place non-visual elements (e.g., services, value objects) here -->
- </fx:Declarations>
- <fx:Script>
- <![CDATA[
- import flash.media.Sound;
- import mx.collections.ArrayCollection;
- import mx.collections.ArrayList;
- import mx.controls.Alert;
- import mx.effects.Tween;
- import mx.events.ListEvent;
- import scripts.AlertSound;
- import scripts.LabDataLoad;
- import scripts.LabEQ;
- import spark.events.IndexChangeEvent;
- //[Bindable]
- private var equipmentAC:Array = new Array();
- private var equipmentXL:LabDataLoad;
- private var equipmentList:ArrayList;
- private function main():void
- {
- trace("main fired");
- this.equipmentXL = new LabDataLoad("data/labEquipment.xml");
- trace("LabDataLoad instance created");
- equipmentXL.addEventListener("XmlLoadedCompleteEvent", xmlCompleted);
- }
- private function xmlCompleted(e:Event):void
- {
- this.equipmentAC = this.equipmentXL.returnArray();
- equipmentList = new ArrayList(equipmentAC);
- this.eqViewList.dataProvider = equipmentList;
- this.eqDataList.dataProvider = equipmentList;
- }
- private function listChangeEvent(event:IndexChangeEvent):void
- {
- var equipmentClicked:LabEQ = LabEQ(event.currentTarget.selectedItem);
- this.viewTitle.text = equipmentClicked.title;
- this.labImg.source = equipmentClicked.imageURL;
- this.viewDescript.text = equipmentClicked.description;
- this.dataTitle.text = equipmentClicked.title;
- this.dataCategory.text = equipmentClicked.equipmentCategory;
- this.dataPurchase.text = equipmentClicked.yearOfPurchase;
- this.dataDescript.text = equipmentClicked.description;
- this.dataLife.text = equipmentClicked.averageHourlyLife;
- this.labThumb.source = equipmentClicked.imageThumbURL;
- }
- private function cbFilterEvent (evt:Event):void
- {
- var SelectedFilter:String = evt.currentTarget.selectedItem;
- if(SelectedFilter == "ALL")
- {
- //Revert to original data provider
- this.eqViewList.dataProvider = equipmentList;
- this.eqDataList.dataProvider = equipmentList;
- }
- else
- {
- var newDataProvider:ArrayCollection = new ArrayCollection();
- for each (var tempEQ:LabEQ in this.equipmentAC)
- {
- //Declare if the selected filter is anything but ALL and populated field accordingly
- if(tempEQ.equipmentCategory == SelectedFilter)
- {
- newDataProvider.addItem(tempEQ);
- }
- }
- this.eqViewList.dataProvider = newDataProvider;
- this.eqDataList.dataProvider = newDataProvider;
- }
- }
- /* protected function eqViewList_changeHandler(event:IndexChangeEvent):void
- {
- // TODO Auto-generated method stub
- } */
- private function tabClick (chatX:Number):void{
- if (chatX == 910){
- chatBox.chatPanel.alpha = 1.0;
- chatBox.x = 0;
- }
- else{
- chatBox.x = 910;
- chatBox.chatPanel.alpha = 0.0;
- }
- }
- public function gotIt():void{
- thermSWF.content.addEventListener("tempAlert", displayAlert);
- mapAlert();
- }
- public function displayAlert(evt:Event):void{
- new AlertSound().play();
- alertBox.alpha = 1.0;
- alertBox.x = 227;
- alertBox.y = 108;
- }
- public function ginsengAlert():void {
- alertBox.alpha = 0.0;
- alertBox.x = -261;
- alertBox.y = 286;
- }
- public function mapAlert():void {
- ginsengMap.fOneSymbol.containerStyleName = "alertStyle";
- ginsengMap.fTwoSymbol.containerStyleName = "alertStyle";
- }
- ]]>
- </fx:Script>
- <s:Image id="bgLogin" includeIn="Login" x="0" y="0" source="assets/background.png"/>
- <s:TextInput x="712" y="165" prompt="Username" includeIn="Login"/>
- <s:TextInput x="712" y="214" prompt="Password" includeIn="Login"/>
- <s:Button id="login_btn" x="770" y="262" label="Login" click="currentState='Splash'" includeIn="Login"/>
- <s:Image id="bgMain" includeIn="Main" x="0" y="0" source="assets/background.png"/>
- <mx:ViewStack id="viewstack1" includeIn="Main" x="137" y="96" width="677"
- height="394">
- <s:NavigatorContent id="eqView" width="100%" height="100%" label="Equipment Viewer">
- <s:Image id="labImg" x="218" y="26" width="250" height="250" />
- <s:TextArea id="viewDescript" x="127" y="312" width="423" height="72"/>
- <s:List id="eqViewList" x="31" y="76" height="167"
- change="listChangeEvent(event)"></s:List>
- <mx:ComboBox id="cboViewFilter" x="31" y="26" width="112" change="cbFilterEvent(event)">
- <mx:dataProvider>
- <fx:String>ALL</fx:String>
- <fx:String>Chemical Reaction</fx:String>
- <fx:String>Genetic Manipulation</fx:String>
- <fx:String>General Lab</fx:String>
- </mx:dataProvider>
- </mx:ComboBox>
- <s:TextArea id="viewTitle" x="247" y="280" height="24"/>
- </s:NavigatorContent>
- <s:NavigatorContent id="eqData" width="100%" height="100%" label="Equipment Data">
- <mx:VRule id="dataDivide" x="204" y="36" width="25" height="312"/>
- <s:List id="eqDataList" x="30" y="77" height="167"
- change="listChangeEvent(event)"></s:List>
- <mx:ComboBox id="cboDataFilter" x="30" y="36" width="112" change="cbFilterEvent(event)">
- <mx:dataProvider>
- <fx:String>ALL</fx:String>
- <fx:String>Chemical Reaction</fx:String>
- <fx:String>Genetic Manipulation</fx:String>
- <fx:String>General Lab</fx:String>
- </mx:dataProvider>
- </mx:ComboBox>
- <s:Image id="labThumb" x="251" y="36" width="75" height="75"/>
- <s:Label id="dataTitle" x="350" y="36" text="Label"/>
- <s:Label id="dataCategory" x="251" y="133" text="Label"/>
- <s:Label id="dataPurchase" x="251" y="168" text="Label"/>
- <s:Label id="dataLife" x="251" y="202" text="Label"/>
- <s:TextArea id="dataDescript" x="251" y="233" width="313" height="72"/>
- </s:NavigatorContent>
- <s:NavigatorContent id="maintCalender" width="100%" height="100%" label="Maintenance Calander">
- </s:NavigatorContent>
- </mx:ViewStack>
- <mx:ToggleButtonBar id="toggleBar" includeIn="Main" x="137" y="71" width="679"
- dataProvider="{viewstack1}">
- </mx:ToggleButtonBar>
- <s:Image id="placeholder" includeIn="Splash" x="0" y="0" width="955" height="600"
- source="assets/splash.png"/>
- <s:Button id="placeholder_btn" includeIn="Splash" x="398" y="480" label="Imaginary Splash Screen"
- click="currentState='Menu'"/>
- <s:Image id="bgMenu" includeIn="Menu" x="1" y="1" source="assets/background.png"/>
- <s:Image id="eqBtn" includeIn="Menu" x="88" y="64" source="assets/EqBtn.png" click="currentState='Main'"/>
- <s:Image id="gsBtn" includeIn="Menu" x="498" y="64" source="assets/GsBtn.png" click="currentState='Ginseng'"/>
- <s:Image id="bgGinseng" includeIn="Ginseng" x="-1" y="0" source="assets/background.png"/>
- <s:SWFLoader id="thermSWF" includeIn="Ginseng" x="527" y="69" creationComplete="gotIt()"
- source="assets/Flashweatherservice.swf"/>
- <s:Image id="alertBox" includeIn="Main, Menu" x="-261" y="286"
- source="assets/alert.png" alpha="0" click="ginsengAlert, currentState='Ginseng'"/>
- <comps:ChatUI id="chatBox" x="910" y="0" includeIn="Menu, Main, Ginseng" click="tabClick(chatBox.x)">
- </comps:ChatUI>
- <comps:ginsengMap id="ginsengMap" includeIn="Ginseng" x="57" y="162">
- </comps:ginsengMap>
- <s:Button id="gBackBtn" includeIn="Ginseng" x="27" y="561" label="Button" click="currentState='Menu'"/>
- <s:Button id="menuBackBtn" includeIn="Menu" x="27" y="561" label="Button" click="currentState='Login'"/>
- <s:Button id="mainBackBtn" includeIn="Main" x="27" y="561" label="Button" click="currentState='Menu'"/>
- </s:Application>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement