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] - Added function to determine proper path to a resource for SWF platform.
Date Wed, 08 Feb 2017 19:59:13 GMT
Repository: flex-asjs
Updated Branches:
  refs/heads/develop 7829f4cb7 -> 9a543ab1f


Added function to determine proper path to a resource for SWF platform.


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

Branch: refs/heads/develop
Commit: 9a543ab1f7458565e8e50d0d48a40f75736cf0a8
Parents: 7829f4c
Author: Peter Ent <pent@apache.org>
Authored: Wed Feb 8 14:59:11 2017 -0500
Committer: Peter Ent <pent@apache.org>
Committed: Wed Feb 8 14:59:11 2017 -0500

----------------------------------------------------------------------
 .../projects/Core/src/main/flex/CoreClasses.as  |  2 +-
 .../main/flex/org/apache/flex/utils/URLUtils.as | 28 +++++++++++++++++++-
 2 files changed, 28 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9a543ab1/frameworks/projects/Core/src/main/flex/CoreClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/CoreClasses.as b/frameworks/projects/Core/src/main/flex/CoreClasses.as
index c290cdb..a5af3ca 100644
--- a/frameworks/projects/Core/src/main/flex/CoreClasses.as
+++ b/frameworks/projects/Core/src/main/flex/CoreClasses.as
@@ -155,9 +155,9 @@ internal class CoreClasses
 	import org.apache.flex.utils.Timer; Timer;
 	import org.apache.flex.utils.UIDUtil; UIDUtil;
 	import org.apache.flex.utils.UIUtils; UIUtils;
+	import org.apache.flex.utils.URLUtils; URLUtils;
 	COMPILE::JS
 	{
-		import org.apache.flex.utils.URLUtils; URLUtils;
         import org.apache.flex.events.utils.EventUtils; EventUtils;
 	}
 

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9a543ab1/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/URLUtils.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/URLUtils.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/URLUtils.as
index d7ac18a..9989fc4 100644
--- a/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/URLUtils.as
+++ b/frameworks/projects/Core/src/main/flex/org/apache/flex/utils/URLUtils.as
@@ -18,6 +18,11 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.flex.utils
 {
+		
+	COMPILE::SWF {
+		import org.apache.flex.core.IUIBase;
+	}
+		
 	/**
 	 *  The URLUtils class is a collection of static functions that wrap dealing with object
URLs in the browser.
 	 *  
@@ -26,7 +31,6 @@ package org.apache.flex.utils
 	 *  @playerversion AIR 2.6
 	 *  @productversion FlexJS 0.7
 	 */
-	COMPILE::JS
 	public class URLUtils
 	{
 		/**
@@ -35,6 +39,7 @@ package org.apache.flex.utils
 		 * @param  win:*=null   The active window can be optionally specified
 		 * @return              The object URL
 		 */
+		COMPILE::JS
 		public static function createObjectURL(blobOrFile:*,win:*=null):String
 		{
 			win = win || window;
@@ -45,6 +50,7 @@ package org.apache.flex.utils
 
 			return "";
 		}
+		COMPILE::JS
 		public static function revokeObjectURL(objectURL:String,win:*=null):void
 		{
 			win = win || window;
@@ -53,6 +59,26 @@ package org.apache.flex.utils
 			if(win.webkitURL)
 				win.webkitURL.revokeObjectURL(objectURL);
 		}
+		
+		public static function getFullPath(host:Object, url:String):String
+		{
+			COMPILE::SWF {
+				if (host is IUIBase) {
+					var loaderURL:String = host["$displayObject"]["loaderInfo"]["url"];
+					var lastPos:Number = loaderURL.lastIndexOf('/');
+					if (lastPos > 0) {
+						loaderURL = loaderURL.substr(0,lastPos+1); // want the '/'
+					}
+					return loaderURL + url;
+				} else {
+					return url;
+				}
+			}
+				
+			COMPILE::JS {
+				return url;
+			}
+		}
 	}
 
 }


Mime
View raw message