flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bigosma...@apache.org
Subject [3/7] git commit: [flex-asjs] [refs/heads/develop] - Intercept various flash.events.MouseEvent types and throw their FlexJS equivalents
Date Fri, 17 Oct 2014 23:45:49 GMT
Intercept various flash.events.MouseEvent types and throw their FlexJS equivalents


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

Branch: refs/heads/develop
Commit: 15a535d005a2314ef4e1e4b6a060e506683927f7
Parents: f665b37
Author: OmPrakash Muppirala <bigosmallm@gmail.com>
Authored: Fri Oct 17 14:53:51 2014 -0700
Committer: OmPrakash Muppirala <bigosmallm@gmail.com>
Committed: Fri Oct 17 14:53:51 2014 -0700

----------------------------------------------------------------------
 .../FlexJSUI/src/org/apache/flex/core/UIBase.as | 43 +++++++++++++++++++-
 1 file changed, 41 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/15a535d0/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/UIBase.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/UIBase.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/UIBase.as
index 18953be..46f4d64 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/UIBase.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/UIBase.as
@@ -25,6 +25,7 @@ package org.apache.flex.core
 	
 	import org.apache.flex.events.Event;
 	import org.apache.flex.events.IEventDispatcher;
+	import org.apache.flex.events.MouseEvent;
 	
 	/**
 	 *  Set a different class for click events so that
@@ -63,18 +64,56 @@ package org.apache.flex.core
 		{
 			super();
 			
-			addEventListener(MouseEvent.CLICK, clickKiller, false, 9999);
+			addEventListener(flash.events.MouseEvent.CLICK, clickKiller, false, 9999);
+			addEventListener(flash.events.MouseEvent.MOUSE_DOWN, mouseEventKiller, false, 9999);
+			addEventListener(flash.events.MouseEvent.MOUSE_UP, mouseEventKiller, false, 9999);
+			addEventListener(flash.events.MouseEvent.ROLL_OVER, mouseEventKiller, false, 9999);
+			addEventListener(flash.events.MouseEvent.ROLL_OUT, mouseEventKiller, false, 9999);
+			addEventListener(flash.events.MouseEvent.MOUSE_OVER, mouseEventKiller, false, 9999);
+			addEventListener(flash.events.MouseEvent.MOUSE_OUT, mouseEventKiller, false, 9999);
 		}
 		
 		private function clickKiller(event:flash.events.Event):void
 		{
-			if (event is MouseEvent)
+			if (event is flash.events.MouseEvent)
 			{
 				event.stopImmediatePropagation();
 				dispatchEvent(new org.apache.flex.events.Event("click"));
 			}
 		}
 		
+		private function mouseEventKiller(event:flash.events.MouseEvent):void
+		{
+			if (event is flash.events.MouseEvent)
+			{
+				event.stopImmediatePropagation();
+				if(event.type == flash.events.MouseEvent.MOUSE_DOWN)
+				{
+					dispatchEvent(new org.apache.flex.events.MouseEvent(org.apache.flex.events.MouseEvent.MOUSE_DOWN,true));
+				}
+				else if(event.type == flash.events.MouseEvent.MOUSE_UP)
+				{
+					dispatchEvent(new org.apache.flex.events.MouseEvent(org.apache.flex.events.MouseEvent.MOUSE_UP,true));
+				}
+				else if(event.type == flash.events.MouseEvent.MOUSE_OVER)
+				{
+					dispatchEvent(new org.apache.flex.events.MouseEvent(org.apache.flex.events.MouseEvent.MOUSE_OVER,true));
+				}
+				else if(event.type == flash.events.MouseEvent.MOUSE_OUT)
+				{
+					dispatchEvent(new org.apache.flex.events.MouseEvent(org.apache.flex.events.MouseEvent.MOUSE_OUT,true));
+				}
+				else if(event.type == flash.events.MouseEvent.ROLL_OVER)
+				{
+					dispatchEvent(new org.apache.flex.events.MouseEvent(org.apache.flex.events.MouseEvent.ROLL_OVER,true));
+				}
+				else if(event.type == flash.events.MouseEvent.ROLL_OUT)
+				{
+					dispatchEvent(new org.apache.flex.events.MouseEvent(org.apache.flex.events.MouseEvent.ROLL_OUT,true));
+				}
+			}
+		}
+		
 		private var _explicitWidth:Number;
         
         /**


Mime
View raw message