| <?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:View xmlns:fx="http://ns.adobe.com/mxml/2009" add="addHandler()" |
| xmlns:s="library://ns.adobe.com/flex/spark" title="Flip" |
| backgroundColor="#606060"> |
| |
| <s:navigationContent> |
| <s:Button label="Back" click="popBack();"/> |
| </s:navigationContent> |
| |
| <s:actionContent> |
| <s:Button label="Home" left="0" click="navigator.popToFirstView();"/> |
| </s:actionContent> |
| |
| <fx:Script> |
| <![CDATA[ |
| import mx.utils.ObjectUtil; |
| |
| import spark.transitions.ViewTransitionBase; |
| import spark.transitions.ZoomViewTransition; |
| |
| private function popCurrentView():void |
| { |
| saveData(); |
| navigator.popView(createTransition()); |
| } |
| |
| private function popBack():void |
| { |
| var zv:ZoomViewTransition = createTransition() as ZoomViewTransition; |
| zv.mode = "out"; |
| navigator.popView(zv); |
| } |
| |
| private function pushNextView():void |
| { |
| saveData(); |
| var newData:Object = ObjectUtil.clone(data); |
| newData.depth = data.depth ? data.depth + 1 : 1; |
| navigator.pushView(ZoomTransitionView, newData, null, createTransition()); |
| } |
| |
| private function saveData():void |
| { |
| data.mode = modeGroup.selectedValue; |
| data.duration = duration.text; |
| } |
| |
| private function addHandler():void |
| { |
| if (data.duration) |
| duration.text = data.duration; |
| |
| if (data.depth) |
| title = "Zoom " + data.depth; |
| } |
| |
| private function createTransition():ViewTransitionBase |
| { |
| var zoom:ZoomViewTransition = new ZoomViewTransition(); |
| zoom.duration = Number(duration.text); |
| zoom.mode = out.selected ? "out" : "in"; |
| return zoom; |
| } |
| ]]> |
| </fx:Script> |
| |
| <s:VGroup left="0" top="0" right="0" bottom="0" paddingTop="30" paddingLeft="30"> |
| <s:Label text="Duration (ms):"/> |
| <s:TextInput id="duration" text="350" width="200"/> |
| <s:Label text="Mode:"/> |
| <s:TileGroup width="100%" requestedColumnCount="2" horizontalAlign="left"> |
| <s:RadioButton group="{modeGroup}" label="IN" selected="true"/> |
| <s:RadioButton id="out" group="{modeGroup}" label="OUT" /> |
| </s:TileGroup> |
| |
| </s:VGroup> |
| |
| <s:HGroup bottom="0" width="100%" gap="0"> |
| <s:Button label="PopView" width="100%" click="popCurrentView();" styleName="footer"/> |
| <s:Button label="PushView" width="100%" styleName="footer" click="pushNextView()"/> |
| </s:HGroup> |
| |
| <fx:Declarations> |
| <s:RadioButtonGroup id="modeGroup"/> |
| </fx:Declarations> |
| |
| </s:View> |