This is an automated email from the ASF dual-hosted git repository.
gregdove pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
The following commit(s) were added to refs/heads/develop by this push:
new 7ac136b0fe Add a first cut approach for mxml
ioError="eventHandler(event)" in mx:Image (also added "complete" event metadata)
7ac136b0fe is described below
commit 7ac136b0fe47745bac5900ebc59b71dd7fb9f1f1
Author: greg-dove <[email protected]>
AuthorDate: Mon Jun 27 15:48:52 2022 +1200
Add a first cut approach for mxml ioError="eventHandler(event)" in mx:Image
(also added "complete" event metadata)
---
.../MXRoyale/src/main/royale/mx/controls/Image.as | 38 ++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/Image.as
b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/Image.as
index ecaa7f3a4a..4e0ee59716 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/Image.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/Image.as
@@ -43,6 +43,7 @@ import mx.controls.listClasses.IDropInListItemRenderer;
import mx.controls.listClasses.IListItemRenderer;
import mx.core.IDataRenderer;
import mx.events.HTTPStatusEvent;
+import mx.events.IOErrorEvent;
/*
@@ -53,6 +54,22 @@ use namespace mx_internal;
// Events
//--------------------------------------
+
+/**
+ * Dispatched when content loading is complete.
+ *
+ * <p>This event is dispatched regardless of whether the load was triggered
+ * by an autoload or an explicit call to the <code>load()</code> method.</p>
+ *
+ * @eventType flash.events.Event.COMPLETE
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Royale 0.9.10
+ */
+[Event(name="complete", type="org.apache.royale.events.Event")]
+
/**
* Dispatched when the <code>data</code> property changes.
*
@@ -82,6 +99,20 @@ use namespace mx_internal;
* @productversion Flex 3
*/
[Event(name="httpStatus", type="mx.events.HTTPStatusEvent")]
+
+
+/**
+ * Dispatched when an input/output error occurs.
+ * @see mx.events.IOErrorEvent
+ *
+ * @eventType flash.events.IOErrorEvent.IO_ERROR
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Royale 0.9.10
+ */
+[Event(name="ioError", type="mx.events.IOErrorEvent")]
//--------------------------------------
// Other metadata
//--------------------------------------
@@ -479,6 +510,7 @@ public class Image extends UIComponent
if (_imgElement.src != binaryDataAsString) {
isContentLoaded = false;
_imgElement.addEventListener("load", handleImageLoaded);
+ _imgElement.addEventListener("error", handleImageError);
_imgElement.src = binaryDataAsString;
}
}
@@ -489,6 +521,12 @@ public class Image extends UIComponent
return _imgElement.complete;
}
+ COMPILE::JS
+ private function handleImageError(event:BrowserEvent):void
+ {
+ dispatchEvent(new IOErrorEvent(IOErrorEvent.IO_ERROR))
+ }
+
COMPILE::JS
private function handleImageLoaded(event:BrowserEvent):void
{