You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by bi...@apache.org on 2014/12/10 21:41:37 UTC

[3/3] git commit: [flex-examples] [refs/heads/develop] - updated slide to close

updated slide to close


Project: http://git-wip-us.apache.org/repos/asf/flex-examples/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-examples/commit/ce401d56
Tree: http://git-wip-us.apache.org/repos/asf/flex-examples/tree/ce401d56
Diff: http://git-wip-us.apache.org/repos/asf/flex-examples/diff/ce401d56

Branch: refs/heads/develop
Commit: ce401d56605bb210cc8a054f7fe42d4bab616cc4
Parents: fec2c3b
Author: anash13 <an...@gmail.com>
Authored: Wed Nov 12 15:32:48 2014 -0500
Committer: OmPrakash Muppirala <bi...@gmail.com>
Committed: Wed Dec 10 12:24:22 2014 -0800

----------------------------------------------------------------------
 tourdeflexmobile/src/TourDeFlexMobile.mxml | 112 +++++++++++-------------
 1 file changed, 51 insertions(+), 61 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-examples/blob/ce401d56/tourdeflexmobile/src/TourDeFlexMobile.mxml
----------------------------------------------------------------------
diff --git a/tourdeflexmobile/src/TourDeFlexMobile.mxml b/tourdeflexmobile/src/TourDeFlexMobile.mxml
index 9d71bb4..223b14f 100644
--- a/tourdeflexmobile/src/TourDeFlexMobile.mxml
+++ b/tourdeflexmobile/src/TourDeFlexMobile.mxml
@@ -20,19 +20,14 @@ 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"
+			   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 AIRViews.NativeAppView;
-			
-			import flash.events.Event;
 			import flash.events.MouseEvent;
-			import flash.events.TimerEvent;
-			import flash.utils.Timer;
 			
 			import mx.core.FlexGlobals;
 			import mx.events.FlexEvent;
@@ -50,10 +45,10 @@ limitations under the License.
 			import LayoutViews.CoverFlowLayoutView;
 			import LayoutViews.HorizontalLayoutView;
 			import LayoutViews.RolodexLayoutView;
+			import LayoutViews.StackLayoutView;
 			import LayoutViews.TileLayoutView;
 			import LayoutViews.TimeMachineLayoutView;
 			import LayoutViews.VerticalLayoutView;
-			import LayoutViews.StackLayoutView;
 			
 			import UIViews.ButtonBarView;
 			import UIViews.CalloutButtonView;
@@ -67,14 +62,16 @@ limitations under the License.
 			import UIViews.TextInputView;
 			import UIViews.ToggleSwitchView;
 			
-			import views.HttpServiceView;
+			import flashx.textLayout.container.ScrollPolicy;
 			
-			private var isOpen:Boolean;	
+			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); 			
+				stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseDown); 
 				lateralMenu.x = lateralMenu.width * -1;
 			}
 			
@@ -86,75 +83,72 @@ limitations under the License.
 			
 			protected function mouseDown(event:MouseEvent):void 
 			{			
-				//	if (!navigator.mouseEnabled && mouseX < 210 && mouseY > 45 && mouseY < navigator.height - 50) 
-				//	{								
-				//		lateralMenu.addEventListener(MouseEvent.MOUSE_UP, mouseUp);					
-				//		lateralMenu.addEventListener(MouseEvent.MOUSE_MOVE, mouseMove);			
-				//	}	
-				if (navigator.mouseEnabled && mouseX < 20 && mouseY > 45 && mouseY < navigator.height - 50)
+				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 
-			{				
-				navigator.mouseEnabled = false;		
-				var myRectangle:Rectangle = new Rectangle(-215, 42, 215, 0);
-				lateralMenu.startDrag(false, myRectangle );
-				trace(lateralMenu.x)
-				//lateralMenu.addEventListener(MouseEvent.CLICK,suppressClick,true,9999,true);
+			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) 
-				{
-					lateralMenu.stopDrag();
-			
-					moveOut.play();
-					isOpen == false;					
+				if (lateralMenu.x <= -65) 
+				{		
+					moveOut.play();		
+					currentState = "closed";	
+					obfuscationGroup.visible = false;
 				}
 				if (lateralMenu.x > -65) 
-				{
-					lateralMenu.stopDrag();
+				{	
 					moveIn.play();
-					isOpen == true;					
+					currentState = "open";			
 				}
 				lateralMenu.stopDrag();	
-				lateralMenu.removeEventListener(MouseEvent.MOUSE_UP, mouseUp);				
-				lateralMenu.removeEventListener(MouseEvent.MOUSE_DOWN, mouseMove);		
-			}	*/	
-			
-			
+				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 );	
+				lateralMenu.startDrag(false, myRectangle);	
 				obfuscationGroup.visible = true;
 				obfuscationLayer.alpha = (lateralMenu.x + 216) * .47 / 200	
-				trace(obfuscationLayer.alpha);
 			} 
 			
 			protected function mouseUpIn(event:MouseEvent):void 
-			{		
-				if (lateralMenu.x > -115) 
+			{					
+				if (lateralMenu.x >= -115) 
 				{
-					lateralMenu.stopDrag();
 					moveIn.play();
-					isOpen == true;	
-					currentState = "closed";
+					currentState = "open";
 				}
 				if (lateralMenu.x < -115) 
-				{
-					lateralMenu.stopDrag();
+				{					
 					moveOut.play();
-					isOpen == false;	
-					obfuscationGroup.visible = false;
-					currentState = "open";
+					currentState = "closed";
+					obfuscationGroup.visible = false;				
 				}
 				lateralMenu.stopDrag();
 				stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUpIn);
@@ -162,21 +156,18 @@ limitations under the License.
 			}
 			
 			protected function menuHandler():void
-			{
-				
+			{				
 				if(lateralMenu.x == 0)
 				{
 					obfuscationGroup.visible = false;
 					parallelOut.play();			
-					isOpen = false;
-					currentState = "open";
+					currentState = "closed";
 				} 
 				else if(lateralMenu.x == -215)
 				{
 					obfuscationGroup.visible = true;
 					parallelIn.play();		
-					isOpen = true;
-					currentState = "closed";
+					currentState = "open";
 				}
 			}
 			
@@ -195,12 +186,12 @@ limitations under the License.
 			<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="iconOpen" 
+		<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="iconClose" 
+		<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')"
@@ -259,6 +250,5 @@ limitations under the License.
 				<fx:Object label="HTTPService" type="view" view="{HttpServiceView}"/>
 			</s:ArrayList>
 		</s:List>
-	</s:Group>
-	
-</s:Application>
+	</s:Group>	
+</s:Application>
\ No newline at end of file