flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p...@apache.org
Subject git commit: [flex-asjs] [refs/heads/develop] - ImageButton now dispatches a change event when its source property changes. Its view bead now picks up the change to the source property and resets the image.
Date Wed, 08 Feb 2017 20:03:34 GMT
Repository: flex-asjs
Updated Branches:
  refs/heads/develop 9a543ab1f -> 316f9201e


ImageButton now dispatches a change event when its source property changes. Its view bead
now picks up the change to the source property and resets the image.


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

Branch: refs/heads/develop
Commit: 316f9201ebfa5b14b2f791c3bf2b28c5f43467f8
Parents: 9a543ab
Author: Peter Ent <pent@apache.org>
Authored: Wed Feb 8 15:03:32 2017 -0500
Committer: Peter Ent <pent@apache.org>
Committed: Wed Feb 8 15:03:32 2017 -0500

----------------------------------------------------------------------
 .../src/main/flex/org/apache/flex/html/ImageButton.as  |  5 +++++
 .../flex/org/apache/flex/html/beads/ImageButtonView.as | 13 +++++++++++++
 2 files changed, 18 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/316f9201/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/ImageButton.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/ImageButton.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/ImageButton.as
index b3c1f2f..34b1097 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/ImageButton.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/ImageButton.as
@@ -19,6 +19,8 @@
 package org.apache.flex.html
 {
     import org.apache.flex.core.SimpleCSSStyles;
+	import org.apache.flex.events.Event;
+	
     COMPILE::JS
     {
         import org.apache.flex.core.WrappedHTMLElement;
@@ -66,6 +68,7 @@ package org.apache.flex.html
 			return element;
 		}
 
+		[Bindable("sourceChanged")]
 		/**
 		 * Sets the image for the button. This is a URL.
 		 * TODO: figure out how to set the source in the style, rather than using
@@ -86,6 +89,8 @@ package org.apache.flex.html
             	var inputElement:HTMLInputElement = element as HTMLInputElement;
 				inputElement.src = url;
             }
+			
+			dispatchEvent(new Event("sourceChanged"));
         }
 	}
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/316f9201/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/ImageButtonView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/ImageButtonView.as
b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/ImageButtonView.as
index 5f1bf00..92b5aec 100644
--- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/ImageButtonView.as
+++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/ImageButtonView.as
@@ -96,6 +96,8 @@ COMPILE::SWF {
 				setupBackground(upSprite);
 				setupBackground(overSprite, "hover");
 				setupBackground(downSprite, "active");
+				
+				IEventDispatcher(value).addEventListener("sourceChanged", handleSourceChange);
 			}
 		}
 
@@ -146,6 +148,17 @@ COMPILE::SWF {
 				});
 			}
 		}
+		
+		/**
+		 * @private
+		 */
+		COMPILE::SWF
+		private function handleSourceChange(event:org.apache.flex.events.Event):void
+		{
+			setupBackground(upSprite);
+			setupBackground(overSprite, "hover");
+			setupBackground(downSprite, "active");
+		}
 
 		/**
 		 * @private


Mime
View raw message