You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by yi...@apache.org on 2020/10/18 12:20:29 UTC
[royale-asjs] branch develop updated: Add Naive Loader
implementation - untested
This is an automated email from the ASF dual-hosted git repository.
yishayw 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 3dcad0e Add Naive Loader implementation - untested
3dcad0e is described below
commit 3dcad0e65afbb30e0dced264a45097e0c936e54f
Author: Yishay Weiss <yi...@yell.com>
AuthorDate: Sun Oct 18 13:20:01 2020 +0100
Add Naive Loader implementation - untested
---
.../MXRoyale/src/main/royale/MXRoyaleClasses.as | 1 +
.../MXRoyale/src/main/royale/mx/display/Loader.as | 62 ++++++++++++++++++++++
.../src/main/royale/mx/display/LoaderInfo.as | 39 ++++++++++++++
3 files changed, 102 insertions(+)
diff --git a/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as b/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as
index 4b6e665..bd8c34b 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as
@@ -178,6 +178,7 @@ internal class MXRoyaleClasses
import mx.errors.EOFError; EOFError;
import mx.events.TextEvent; TextEvent;
import mx.display.Bitmap; Bitmap;
+ import mx.display.Loader; Loader;
import mx.external.ExternalInterface; ExternalInterface;
import mx.events.KeyboardEvent; KeyboardEvent;
import mx.geom.Matrix; Matrix;
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/display/Loader.as b/frameworks/projects/MXRoyale/src/main/royale/mx/display/Loader.as
new file mode 100644
index 0000000..e1f9793
--- /dev/null
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/display/Loader.as
@@ -0,0 +1,62 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package mx.display
+{
+ import mx.core.UIComponent;
+ import mx.controls.Image;
+ import org.apache.royale.net.URLRequest;
+ import org.apache.royale.events.Event;
+
+ public class Loader extends UIComponent
+ {
+ private var _contentLoaderInfo:LoaderInfo;
+ private var _content:UIComponent;
+
+ public function get contentLoaderInfo():LoaderInfo
+ {
+ if (!_contentLoaderInfo)
+ {
+ _contentLoaderInfo = new LoaderInfo(this);
+ }
+ return _contentLoaderInfo;
+ }
+
+ public function get content():UIComponent
+ {
+ if (!_content)
+ {
+ _content = new Image();
+ _content.addEventListener(Event.COMPLETE, loadCompleteHandler)
+ }
+ return _content;
+ }
+
+ public function load(request:URLRequest, context:Object=null):void
+ {
+ (content as Image).source = request.url;
+ }
+
+
+ private function loadCompleteHandler(event:Event):void
+ {
+ addElement(_content);
+ contentLoaderInfo.dispatchEvent(Event.COMPLETE);
+ }
+ }
+}
\ No newline at end of file
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/display/LoaderInfo.as b/frameworks/projects/MXRoyale/src/main/royale/mx/display/LoaderInfo.as
new file mode 100644
index 0000000..c7d5787
--- /dev/null
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/display/LoaderInfo.as
@@ -0,0 +1,39 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package mx.display
+{
+ import org.apache.royale.events.EventDispatcher;
+
+ public class LoaderInfo extends EventDispatcher
+ {
+ private var _loader:Loader;
+
+ public function LoaderInfo(loaderValue:Loader)
+ {
+ super();
+ _loader = loaderValue;
+ }
+
+ public function get loader():Loader
+ {
+ return _loader;
+ }
+
+ }
+}
\ No newline at end of file