You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ca...@apache.org on 2020/07/12 15:45:50 UTC
[royale-asjs] 01/01: jewel-imagebutton: changes to make it button
with nested img instead of input type image - ErrorImage is not working
-check TDJ example
This is an automated email from the ASF dual-hosted git repository.
carlosrovira pushed a commit to branch feature/jewel-imagebutton-changes
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
commit 5e6187ea4c6239485ea51be8bcd531a6d8a25963
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Sun Jul 12 17:45:38 2020 +0200
jewel-imagebutton: changes to make it button with nested img instead of input type image - ErrorImage is not working -check TDJ example
---
.../royale/org/apache/royale/jewel/ImageButton.as | 29 +++++++++++-----------
1 file changed, 14 insertions(+), 15 deletions(-)
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/ImageButton.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/ImageButton.as
index c8d8ff4..1527fa1 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/ImageButton.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/ImageButton.as
@@ -63,8 +63,9 @@ package org.apache.royale.jewel
COMPILE::JS
override protected function createElement():WrappedHTMLElement
{
- addElementToWrapper(this, 'input');
- element.setAttribute('type', 'image');
+ addElementToWrapper(this,'button');
+ element.setAttribute('type', 'button');
+
return element;
}
@@ -87,22 +88,14 @@ package org.apache.royale.jewel
ImageModel(model).url = url;
COMPILE::SWF
{
- if (!style)
- style = new SimpleCSSStyles();
- style.backgroundImage = url;
+ if (!style)
+ style = new SimpleCSSStyles();
+ style.backgroundImage = url;
}
COMPILE::JS
{
- if(!_imageElement)
- {
- (element as HTMLInputElement).src = url;
- _imageElement = (element as HTMLInputElement);
- }
- if (_imageElement && url)
- {
- (_imageElement as HTMLInputElement).src = url;
- }
+ (imageElement as HTMLImageElement).src = url;
}
dispatchEvent(new Event("srcChanged"));
@@ -119,11 +112,17 @@ package org.apache.royale.jewel
* @productversion Royale 0.9.8
* @royaleignorecoercion org.apache.royale.core.IImageButton#imageElement
* @royaleignorecoercion Element
+ * @royaleignorecoercion HTMLImageElement
*/
COMPILE::JS
public function get imageElement():Element
{
- return _imageElement;
+ if(!_imageElement)
+ {
+ _imageElement = document.createElement("img") as HTMLImageElement;
+ element.appendChild(_imageElement);
+ }
+ return _imageElement;
}
}
}