| <?xml version="1.0" encoding="utf-8"?> | |
| <!-- | |
| Licensed to the Apache Software Foundation (ASF) under one or more | |
| contributor license agreements. See the NOTICE file distributed with | |
| this work for additional information regarding copyright ownership. | |
| The ASF licenses this file to You under the Apache License, Version 2.0 | |
| (the "License"); you may not use this file except in compliance with | |
| the License. You may obtain a copy of the License at | |
| http://www.apache.org/licenses/LICENSE-2.0 | |
| Unless required by applicable law or agreed to in writing, software | |
| distributed under the License is distributed on an "AS IS" BASIS, | |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| See the License for the specific language governing permissions and | |
| limitations under the License. | |
| --> | |
| <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" | |
| xmlns:s="library://ns.adobe.com/flex/spark" | |
| applicationDPI="160" frameRate="60" currentState="closed" | |
| applicationComplete="init(event)" | |
| splashScreenImage="@Embed('assets/images/poweredby.png')" | |
| splashScreenScaleMode="letterbox"> | |
| <!-- <fx:Style source="styles.css"/>--> | |
| <fx:Script> | |
| <![CDATA[ | |
| import flash.events.MouseEvent; | |
| import mx.events.FlexEvent; | |
| import spark.events.IndexChangeEvent; | |
| import AIRViews.AccelerometerView; | |
| import AIRViews.CameraUIView; | |
| import AIRViews.GeolocationView; | |
| import AIRViews.NativeAppView; | |
| import AIRViews.SQLiteView; | |
| import LayoutViews.AccordionLayoutView; | |
| import LayoutViews.CarouselLayoutView; | |
| import LayoutViews.CoverFlowLayoutView; | |
| import LayoutViews.HorizontalLayoutView; | |
| import LayoutViews.RolodexLayoutView; | |
| import LayoutViews.StackLayoutView; | |
| import LayoutViews.TileLayoutView; | |
| import LayoutViews.TimeMachineLayoutView; | |
| import LayoutViews.VerticalLayoutView; | |
| import UIViews.ActionBarView; | |
| import UIViews.BusyIndicatorView; | |
| import UIViews.ButtonBarView; | |
| import UIViews.CalloutButtonView; | |
| import UIViews.CheckboxView; | |
| import UIViews.DateSpinnerView; | |
| import UIViews.HscrubberView; | |
| import UIViews.ListView; | |
| import UIViews.MobileGridView; | |
| import UIViews.RadiobuttonView; | |
| import UIViews.SpinnerListView; | |
| import UIViews.TextInputView; | |
| import UIViews.ToggleSwitchView; | |
| import flashx.textLayout.container.ScrollPolicy; | |
| import views.HttpServiceView; | |
| private var prevX:int = 0; | |
| private var curX:int = 0; | |
| protected function init(event:FlexEvent):void | |
| { | |
| stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseDown); | |
| lateralMenu.x = lateralMenu.width * -1; | |
| } | |
| protected function changeHandler(event:IndexChangeEvent):void | |
| { | |
| menuHandler(); | |
| navigator.pushView(componentsList.selectedItem.view); | |
| } | |
| protected function mouseDown(event:MouseEvent):void | |
| { | |
| if (currentState == "open" && mouseX < 210 && mouseY > 45) | |
| { | |
| stage.addEventListener(MouseEvent.MOUSE_UP, mouseUp); | |
| stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMove); | |
| } | |
| if (currentState == "closed" && mouseX < 20 && mouseY > 45 && mouseY < navigator.height - 50) | |
| { | |
| stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpIn); | |
| stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseDownIn); | |
| } | |
| prevX = event.stageX; | |
| } | |
| protected function mouseMove(event:MouseEvent):void | |
| { | |
| curX = stage.mouseX; | |
| if (prevX - curX > 20) | |
| { | |
| lateralMenu.mouseChildren = false; | |
| componentsList.setStyle('verticalScrollPolicy', ScrollPolicy.OFF); | |
| var myRectangle:Rectangle = new Rectangle(-215, 42, 215, 0); | |
| lateralMenu.startDrag(false, myRectangle ); | |
| } | |
| } | |
| protected function mouseUp(event:MouseEvent):void | |
| { | |
| if (lateralMenu.x <= -65) | |
| { | |
| moveOut.play(); | |
| currentState = "closed"; | |
| obfuscationGroup.visible = false; | |
| } | |
| if (lateralMenu.x > -65) | |
| { | |
| moveIn.play(); | |
| currentState = "open"; | |
| } | |
| lateralMenu.stopDrag(); | |
| lateralMenu.mouseChildren = true; | |
| componentsList.setStyle('verticalScrollPolicy', ScrollPolicy.ON); | |
| stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUp); | |
| stage.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMove); | |
| } | |
| protected function mouseDownIn(event:MouseEvent):void | |
| { | |
| //define area for lateralMenu to travel | |
| var myRectangle:Rectangle = new Rectangle(-215, 42, 215, 0); | |
| lateralMenu.startDrag(false, myRectangle); | |
| obfuscationGroup.visible = true; | |
| obfuscationLayer.alpha = (lateralMenu.x + 216) * .47 / 200 | |
| } | |
| protected function mouseUpIn(event:MouseEvent):void | |
| { | |
| if (lateralMenu.x >= -115) | |
| { | |
| moveIn.play(); | |
| currentState = "open"; | |
| } | |
| if (lateralMenu.x < -115) | |
| { | |
| moveOut.play(); | |
| currentState = "closed"; | |
| obfuscationGroup.visible = false; | |
| } | |
| lateralMenu.stopDrag(); | |
| stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUpIn); | |
| stage.removeEventListener(MouseEvent.MOUSE_MOVE, mouseDownIn); | |
| } | |
| protected function menuHandler():void | |
| { | |
| if(lateralMenu.x == 0) | |
| { | |
| obfuscationGroup.visible = false; | |
| parallelOut.play(); | |
| currentState = "closed"; | |
| } | |
| else if(lateralMenu.x == -215) | |
| { | |
| obfuscationGroup.visible = true; | |
| parallelIn.play(); | |
| currentState = "open"; | |
| } | |
| } | |
| ]]> | |
| </fx:Script> | |
| <s:states> | |
| <s:State name="open"/> | |
| <s:State name="closed"/> | |
| </s:states> | |
| <fx:Declarations> | |
| <s:Parallel id="parallelIn"> | |
| <s:Fade id="fadeIn" target="{obfuscationLayer}" alphaFrom="0" alphaTo=".5" duration="300"/> | |
| <s:Move id="moveIn" duration="300" target="{lateralMenu}" xTo="0"/> | |
| </s:Parallel> | |
| <s:Parallel id="parallelOut"> | |
| <s:Fade id="fadeOut" target="{obfuscationLayer}" alphaFrom=".5" alphaTo="0" duration="300"/> | |
| <s:Move id="moveOut" duration="300" target="{lateralMenu}" xTo="-215"/> | |
| </s:Parallel> | |
| <s:MultiDPIBitmapSource source640dpi="@Embed('assets/icons/640/icon.png')" id="iconClose" | |
| source480dpi="@Embed('assets/icons/480/icon.png')" | |
| source320dpi="@Embed('assets/icons/320/icon.png')" | |
| source240dpi="@Embed('assets/icons/240/icon.png')" | |
| source160dpi="@Embed('assets/icons/160/icon.png')"/> | |
| <s:MultiDPIBitmapSource source640dpi="@Embed('assets/icons/640/icon1.png')" id="iconOpen" | |
| source480dpi="@Embed('assets/icons/480/icon1.png')" | |
| source320dpi="@Embed('assets/icons/320/icon1.png')" | |
| source240dpi="@Embed('assets/icons/240/icon1.png')" | |
| source160dpi="@Embed('assets/icons/160/icon1.png')"/> | |
| </fx:Declarations> | |
| <s:ViewNavigator id="navigator" firstView="views.BlogView" width="100%" height="100%"> | |
| <s:navigationContent> | |
| <s:Button icon.open="{iconOpen}" icon.closed="{iconClose}" id="btn" click="menuHandler()"/> | |
| </s:navigationContent> | |
| </s:ViewNavigator> | |
| <s:Group width="100%" height="100%" click="menuHandler()" id="obfuscationGroup" y="43" visible="false"> | |
| <s:Rect id="obfuscationLayer" width="100%" height="100%" alpha="0"> | |
| <s:fill > | |
| <s:SolidColor color="0x000000" /> | |
| </s:fill> | |
| </s:Rect> | |
| </s:Group> | |
| <s:Group id="lateralMenu" width="215" y="43" height="100%"> | |
| <s:RectangularDropShadow left="0" right="0" top="0" bottom="0" alpha=".4" distance="5" angle="90" | |
| blurX="5" blurY="5" color="0x000000"/> | |
| <s:List id="componentsList" itemRenderer="renderers.MenuRenderer" width="215" height="100%" styleName="RobotoEmbedded" | |
| change="changeHandler(event)" contentBackgroundColor="#eeeeee" downColor="#e0e0e0" selectionColor="#33B5E5"> | |
| <s:ArrayList> | |
| <fx:Object label="UI COMPONENTS" type="separator"/> | |
| <fx:Object label="ActionBar" type="view" view="{ActionBarView}"/> | |
| <fx:Object label="BusyIndicator" type="view" view="{BusyIndicatorView}"/> | |
| <fx:Object label="ButtonBar" type="view" view="{ButtonBarView}"/> | |
| <fx:Object label="CalloutButton" type="view" view="{CalloutButtonView}"/> | |
| <fx:Object label="CheckBox" type="view" view="{CheckboxView}"/> | |
| <fx:Object label="DateSpinner" type="view" view="{DateSpinnerView}"/> | |
| <fx:Object label="HSlider" type="view" view="{HscrubberView}"/> | |
| <fx:Object label="List" type="view" view="{ListView}"/> | |
| <fx:Object label="MobileGrid" type="view" view="{MobileGridView}"/> | |
| <fx:Object label="RadioButton" type="view" view="{RadiobuttonView}"/> | |
| <fx:Object label="SpinnerList" type="view" view="{SpinnerListView}"/> | |
| <fx:Object label="TextInput" type="view" view="{TextInputView}"/> | |
| <fx:Object label="ToggleSwitch" type="view" view="{ToggleSwitchView}"/> | |
| <fx:Object label="LAYOUTS" type="separator"/> | |
| <fx:Object label="Accordion Layout" type="view" view="{AccordionLayoutView}"/> | |
| <fx:Object label="Carousel Layout" type="view" view="{CarouselLayoutView}"/> | |
| <fx:Object label="CoverFlow Layout" type="view" view="{CoverFlowLayoutView}"/> | |
| <fx:Object label="Horizontal Layout" type="view" view="{HorizontalLayoutView}"/> | |
| <fx:Object label="Rolodex Layout" type="view" view="{RolodexLayoutView}"/> | |
| <fx:Object label="Stack Layout" type="view" view="{StackLayoutView}"/> | |
| <fx:Object label="Tile Layout" type="view" view="{TileLayoutView}"/> | |
| <fx:Object label="TimeMachine Layout" type="view" view="{TimeMachineLayoutView}"/> | |
| <fx:Object label="Vertical Layout" type="view" view="{VerticalLayoutView}"/> | |
| <fx:Object label="AIR APIs" type="separator"/> | |
| <fx:Object label="Accelerometer" type="view" view="{AccelerometerView}"/> | |
| <!--fx:Object label="Camera" type="view" view="{CameraView}"/--> | |
| <fx:Object label="Geolocation" type="view" view="{GeolocationView}"/> | |
| <!--<fx:Object label="CameraUI" type="view" view="{CameraUIView}"/>--> | |
| <fx:Object label="Native App Integration" type="view" view="{NativeAppView}"/> | |
| <fx:Object label="SQLite" type="view" view="{SQLiteView}"/> | |
| <fx:Object label="DATA ACCESS" type="separator"/> | |
| <fx:Object label="HTTPService" type="view" view="{HttpServiceView}"/> | |
| </s:ArrayList> | |
| </s:List> | |
| </s:Group> | |
| </s:Application> |