You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by pe...@apache.org on 2014/06/19 19:21:08 UTC

git commit: [flex-asjs] [refs/heads/develop] - Added clickKiller code from Button to UIBase.

Repository: flex-asjs
Updated Branches:
  refs/heads/develop 63b41713b -> 25b81124c


Added clickKiller code from Button to UIBase.


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

Branch: refs/heads/develop
Commit: 25b81124c161111c93076aea6fe973bff9eaa550
Parents: 63b4171
Author: Peter Ent <pe...@apache.org>
Authored: Thu Jun 19 13:20:58 2014 -0400
Committer: Peter Ent <pe...@apache.org>
Committed: Thu Jun 19 13:20:58 2014 -0400

----------------------------------------------------------------------
 .../FlexJSUI/src/org/apache/flex/core/UIBase.as | 45 +++++++++++++++-----
 1 file changed, 35 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/25b81124/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 59f9839..db3a079 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
@@ -20,10 +20,24 @@ package org.apache.flex.core
 {
 	import flash.display.DisplayObject;
 	import flash.display.Sprite;
+	import flash.events.Event;
+	import flash.events.MouseEvent;
 	
 	import org.apache.flex.events.Event;
 	import org.apache.flex.events.IEventDispatcher;
 	
+	/**
+	 *  Set a different class for click events so that
+	 *  there aren't dependencies on the flash classes
+	 *  on the JS side.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion FlexJS 0.0
+	 */
+	[Event(name="click", type="org.apache.flex.events.Event")]
+	
     /**
      *  The UIBase class is the base class for most composite user interface
      *  components.  For the Flash Player, Buttons and Text controls may
@@ -48,6 +62,17 @@ package org.apache.flex.core
 		public function UIBase()
 		{
 			super();
+			
+			addEventListener(MouseEvent.CLICK, clickKiller, false, 9999);
+		}
+		
+		private function clickKiller(event:flash.events.Event):void
+		{
+			if (event is MouseEvent)
+			{
+				event.stopImmediatePropagation();
+				dispatchEvent(new org.apache.flex.events.Event("click"));
+			}
 		}
 		
 		private var _explicitWidth:Number;
@@ -80,7 +105,7 @@ package org.apache.flex.core
 			
 			_explicitWidth = value;
 			
-			dispatchEvent(new Event("explicitWidthChanged"));
+			dispatchEvent(new org.apache.flex.events.Event("explicitWidthChanged"));
 		}
 		
 		private var _explicitHeight:Number;
@@ -113,7 +138,7 @@ package org.apache.flex.core
 			
 			_explicitHeight = value;
 			
-			dispatchEvent(new Event("explicitHeightChanged"));
+			dispatchEvent(new org.apache.flex.events.Event("explicitHeightChanged"));
 		}
 		
 		private var _percentWidth:Number;
@@ -148,7 +173,7 @@ package org.apache.flex.core
 			
 			_percentWidth = value;
 			
-			dispatchEvent(new Event("percentWidthChanged"));
+			dispatchEvent(new org.apache.flex.events.Event("percentWidthChanged"));
 		}
 
         private var _percentHeight:Number;
@@ -183,7 +208,7 @@ package org.apache.flex.core
 			
 			_percentHeight = value;
 			
-			dispatchEvent(new Event("percentHeightChanged"));
+			dispatchEvent(new org.apache.flex.events.Event("percentHeightChanged"));
 		}
 		
 		private var _width:Number;
@@ -224,7 +249,7 @@ package org.apache.flex.core
 			if (_width != value)
 			{
 				_width = value;
-				dispatchEvent(new Event("widthChanged"));
+				dispatchEvent(new org.apache.flex.events.Event("widthChanged"));
 			}
 		}
 
@@ -279,7 +304,7 @@ package org.apache.flex.core
 			if (_height != value)
 			{
 				_height = value;
-				dispatchEvent(new Event("heightChanged"));
+				dispatchEvent(new org.apache.flex.events.Event("heightChanged"));
 			}
 		}
         
@@ -324,7 +349,7 @@ package org.apache.flex.core
 			if (_model != value)
 			{
 				addBead(value as IBead);
-				dispatchEvent(new Event("modelChanged"));
+				dispatchEvent(new org.apache.flex.events.Event("modelChanged"));
 			}
 		}
 		
@@ -351,7 +376,7 @@ package org.apache.flex.core
 			if (_id != value)
 			{
 				_id = value;
-				dispatchEvent(new Event("idChanged"));
+				dispatchEvent(new org.apache.flex.events.Event("idChanged"));
 			}
 		}
 		
@@ -379,7 +404,7 @@ package org.apache.flex.core
 			if (_className != value)
 			{
 				_className = value;
-				dispatchEvent(new Event("classNameChanged"));
+				dispatchEvent(new org.apache.flex.events.Event("classNameChanged"));
 			}
 		}
         
@@ -426,7 +451,7 @@ package org.apache.flex.core
 			bead.strand = this;
 			
 			if (bead is IBeadView) {
-				IEventDispatcher(this).dispatchEvent(new Event("viewChanged"));
+				IEventDispatcher(this).dispatchEvent(new org.apache.flex.events.Event("viewChanged"));
 			}
 		}