Permalink
Browse files

build v2.0.0

  • Loading branch information...
Matan
Matan committed Nov 16, 2010
1 parent 4b26269 commit cf715b31407ca7038f9ced1f598335612aa53394
Showing with 2,386 additions and 1 deletion.
  1. +2 −1 .gitignore
  2. +21 −0 LICENSE
  3. BIN bin/AssetLoader-v2.0.0.swc
  4. BIN bin/testing/FlexTestSuite.swf
  5. +14 −0 bin/testing/assets/test/testCSS.css
  6. BIN bin/testing/assets/test/testIMAGE.png
  7. +1 −0 bin/testing/assets/test/testJSON.json
  8. BIN bin/testing/assets/test/testSOUND.mp3
  9. BIN bin/testing/assets/test/testSWF.swf
  10. +26 −0 bin/testing/assets/test/testTXT.txt
  11. BIN bin/testing/assets/test/testVIDEO.flv
  12. +26 −0 bin/testing/assets/test/testXML.xml
  13. BIN bin/testing/assets/test/testZIP.zip
  14. BIN build/libs/as3-signals-v0.8.swc
  15. BIN build/libs/as3corelib-json.swc
  16. +26 −0 build/libs/flexunit/License.txt
  17. BIN build/libs/flexunit/as3-signals-utilities-async-v0.8.swc
  18. BIN build/libs/flexunit/flexUnitTasks.jar
  19. BIN build/libs/flexunit/flexunit-4.0.0.swc
  20. BIN build/libs/flexunit/flexunit-aircilistener-4.0.0.swc
  21. BIN build/libs/flexunit/flexunit-cilistener-4.0.0.swc
  22. BIN build/libs/flexunit/flexunit-flexcoverlistener-4.0.0.swc
  23. BIN build/libs/flexunit/flexunit-uilistener-4.0.0.swc
  24. +173 −0 src/org/assetloader/base/LoaderFactory.as
  25. +153 −0 src/org/assetloader/loaders/BaseLoader.as
  26. +44 −0 src/org/assetloader/signals/ErrorSignal.as
  27. +36 −0 src/org/assetloader/signals/HttpStatusSignal.as
  28. +45 −0 src/org/assetloader/signals/LoaderSignal.as
  29. +36 −0 src/org/assetloader/signals/NetStatusSignal.as
  30. +98 −0 src/org/assetloader/signals/ProgressSignal.as
  31. +28 −0 src_unit/FlexUnitRunner.mxml
  32. +171 −0 src_unit/org/assetloader/AssetLoaderTest.as
  33. +14 −0 src_unit/org/assetloader/AssetLoaderTestSuit.as
  34. +80 −0 src_unit/org/assetloader/base/AbstractLoaderTest.as
  35. +107 −0 src_unit/org/assetloader/base/AssetLoaderQueueTest.as
  36. +12 −0 src_unit/org/assetloader/base/BaseTestSuite.as
  37. +207 −0 src_unit/org/assetloader/base/LoaderFactoryTest.as
  38. +100 −0 src_unit/org/assetloader/base/LoaderStatsTest.as
  39. +55 −0 src_unit/org/assetloader/base/ParamTest.as
  40. +323 −0 src_unit/org/assetloader/loaders/BaseLoaderTest.as
  41. +24 −0 src_unit/org/assetloader/loaders/BinaryLoaderTest.as
  42. +26 −0 src_unit/org/assetloader/loaders/CSSLoaderTest.as
  43. +25 −0 src_unit/org/assetloader/loaders/DisplayObjectLoaderTest.as
  44. +25 −0 src_unit/org/assetloader/loaders/ImageLoaderTest.as
  45. +24 −0 src_unit/org/assetloader/loaders/JSONLoaderTest.as
  46. +9 −0 src_unit/org/assetloader/loaders/LoadersTestSuite.as
  47. +25 −0 src_unit/org/assetloader/loaders/SWFLoaderTest.as
  48. +79 −0 src_unit/org/assetloader/loaders/SoundLoaderTest.as
  49. +24 −0 src_unit/org/assetloader/loaders/TextLoaderTest.as
  50. +97 −0 src_unit/org/assetloader/loaders/VideoLoaderTest.as
  51. +24 −0 src_unit/org/assetloader/loaders/XMLLoaderTest.as
  52. +10 −0 src_unit/org/assetloader/parsers/ConfigParsersTestSuite.as
  53. +196 −0 src_unit/org/assetloader/parsers/XmlConfigParserTest.as
View
@@ -3,7 +3,8 @@
/html-template/*
/bin-debug/*
/bin-release/*
-/bin/**.cache
+/bin/*.cache
+/bin/testing/*.cache
docs/*
obj/*
View
21 LICENSE
@@ -0,0 +1,21 @@
+The MIT License
+
+Copyright (c) 2009, 2010 the original author or authors
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
View
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,14 @@
+body
+{
+ background-color:#d0e4fe;
+}
+h1
+{
+ color:orange;
+ text-align:center;
+}
+p
+{
+ font-family:"Times New Roman";
+ font-size:20px;
+}
Binary file not shown.
@@ -0,0 +1 @@
+{"base":"http://www.matan.co.za/AssetLoader/testAssets/","assets":[{"id":"SAMPLE_GROUP","preventCache":false,"assets":[{"src":"sampleTXT.txt","id":"SAMPLE_TXT"},{"src":"sampleJSON.json","id":"SAMPLE_JSON"},{"src":"sampleXML.xml","id":"SAMPLE_XML"},{"src":"sampleCSS.css","id":"SAMPLE_CSS"},{"src":"sampleZIP.zip","weight":3493,"id":"SAMPLE_BINARY"},{"src":"sampleSOUND.mp3","weight":"213 kb","id":"SAMPLE_SOUND"}],"connections":0},{"assets":[{"src":"sampleIMAGE.jpg","weight":"328.5 kb","id":"SAMPLE_IMAGE"},{"id":"SAMPLE_VIDEO","onDemand":true,"src":"sampleVIDEO.mp4","weight":"10 mb"},{"id":"SAMPLE_SWF","src":"sampleSWF.swf","weight":941410,"priority":1}],"preventCache":true},{"base":"/","id":"SAMPLE_ERROR","src":"fileThatDoesNotExist.php","type":"image","retries":5}],"connections":3}
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,26 @@
+FlexUnit 4 is under an MIT license.
+
+Copyright (c) 2007 Digital Primates IT Consulting Group
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+http://flexunit.org/
Binary file not shown.
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<loader connections="3" base="test/" >
+
+ <group id="SAMPLE_GROUP_01" connections="1" preventCache="false" >
+
+ <group id="SAMPLE_GROUP_02" connections="2" >
+ <asset id="SAMPLE_TXT" src="sampleTXT.txt" />
+ <asset id="SAMPLE_JSON" src="sampleJSON.json" />
+ <asset id="SAMPLE_XML" src="sampleXML.xml" />
+ <asset id="SAMPLE_CSS" src="sampleCSS.css" />
+ </group>
+
+ <asset id="SAMPLE_BINARY" src="sampleZIP.zip" weight="3493" />
+ <asset id="SAMPLE_SOUND" src="sampleSOUND.mp3" weight="213 kb" />
+
+ </group>
+
+ <assets preventCache="true" >
+ <asset id="SAMPLE_IMAGE" src="sampleIMAGE.png" weight="5 kb" fillColor="0x0" smoothing="true" transparent="true" />
+ <asset id="SAMPLE_VIDEO" src="sampleVIDEO.flv" weight="0.312 mb" onDemand="true" />
+ <asset id="SAMPLE_SWF" src="sampleSWF.swf" weight="526" priority="1" />
+ </assets>
+
+ <asset id="SAMPLE_ERROR" base="/" src="fileThatDoesNotExist.php" type="image" retries="5" />
+
+</loader>
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,26 @@
+FlexUnit 4 is under an MIT license.
+
+Copyright (c) 2007 Digital Primates IT Consulting Group
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+http://flexunit.org/
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,173 @@
+package org.assetloader.base
+{
+ import org.assetloader.AssetLoader;
+ import org.assetloader.core.ILoader;
+ import org.assetloader.core.IParam;
+ import org.assetloader.loaders.BinaryLoader;
+ import org.assetloader.loaders.CSSLoader;
+ import org.assetloader.loaders.DisplayObjectLoader;
+ import org.assetloader.loaders.ImageLoader;
+ import org.assetloader.loaders.JSONLoader;
+ import org.assetloader.loaders.SWFLoader;
+ import org.assetloader.loaders.SoundLoader;
+ import org.assetloader.loaders.TextLoader;
+ import org.assetloader.loaders.VideoLoader;
+ import org.assetloader.loaders.XMLLoader;
+
+ import flash.net.URLRequest;
+
+ /**
+ * @author Matan Uberstein
+ */
+ public class LoaderFactory
+ {
+ protected var _loader : AbstractLoader;
+
+ public function LoaderFactory()
+ {
+ }
+
+ public function produce(id : String, type : String = "AUTO", request : URLRequest = null, params : Array = null, parent : ILoader = null) : ILoader
+ {
+ if(request)
+ {
+ var urlPattern : RegExp = /((?P<protocol>[a-zA-Z]+: \/\/) (?P<host>[^:\/]*) (:(?P<port>\d+))?)? (?P<path>[^?]*)? ((?P<query>.*))? /x;
+ var urlMatch : * = urlPattern.exec(request.url);
+ if(urlMatch)
+ {
+ var path : String = urlMatch.path;
+ var fileExtension : String = path.slice(path.lastIndexOf(".") + 1);
+ }
+ else
+ throw new AssetLoaderError(AssetLoaderError.INVALID_URL);
+
+ if(type == AssetType.AUTO)
+ type = getTypeFromExtension(fileExtension);
+ }
+ else if(type == AssetType.AUTO)
+ type = AssetType.GROUP;
+
+ constructLoader(type, id, request, parent);
+
+ if(params)
+ processParams(params);
+
+ return _loader;
+ }
+
+ protected function processParams(assetParams : Array) : void
+ {
+ var pL : int = assetParams.length;
+ for(var i : int = 0;i < pL;i++)
+ {
+ if(assetParams[i] is IParam)
+ {
+ var param : IParam = assetParams[i];
+ _loader.setParam(param.id, param.value);
+ }
+ else if(assetParams[i] is Array)
+ processParams(assetParams[i]);
+ }
+ }
+
+ protected function getTypeFromExtension(extension : String) : String
+ {
+ extension = extension.toLowerCase();
+
+ var textExt : Array = ["txt", "js", "html", "htm", "php", "asp", "aspx", "jsp", "cfm"];
+ var imageExt : Array = ["jpg", "jpeg", "png", "gif"];
+ var videoExt : Array = ["flv", "f4v", "f4p", "mp4", "mov"];
+
+ if(testExtenstion(textExt, extension))
+ return AssetType.TEXT;
+
+ if(extension == "json")
+ return AssetType.JSON;
+
+ if(extension == "xml")
+ return AssetType.XML;
+
+ if(extension == "css")
+ return AssetType.CSS;
+
+ if(extension == "zip")
+ return AssetType.BINARY;
+
+ if(extension == "swf")
+ return AssetType.SWF;
+
+ if(testExtenstion(imageExt, extension))
+ return AssetType.IMAGE;
+
+ if(extension == "mp3")
+ return AssetType.SOUND;
+
+ if(testExtenstion(videoExt, extension))
+ return AssetType.VIDEO;
+
+ throw new AssetLoaderError(AssetLoaderError.ASSET_AUTO_TYPE_NOT_FOUND);
+
+ return "";
+ }
+
+ protected function testExtenstion(extensions : Array, extension : String) : Boolean
+ {
+ if(extensions.indexOf(extension) != -1)
+ return true;
+ return false;
+ }
+
+ protected function constructLoader(type : String, id : String, request : URLRequest, parent : ILoader) : void
+ {
+ switch(type)
+ {
+ case AssetType.TEXT:
+ _loader = new TextLoader(id, request, parent);
+ break;
+
+ case AssetType.JSON:
+ _loader = new JSONLoader(id, request, parent);
+ break;
+
+ case AssetType.XML:
+ _loader = new XMLLoader(id, request, parent);
+ break;
+
+ case AssetType.CSS:
+ _loader = new CSSLoader(id, request, parent);
+ break;
+
+ case AssetType.BINARY:
+ _loader = new BinaryLoader(id, request, parent);
+ break;
+
+ case AssetType.DISPLAY_OBJECT:
+ _loader = new DisplayObjectLoader(id, request, parent);
+ break;
+
+ case AssetType.SWF:
+ _loader = new SWFLoader(id, request, parent);
+ break;
+
+ case AssetType.IMAGE:
+ _loader = new ImageLoader(id, request, parent);
+ break;
+
+ case AssetType.SOUND:
+ _loader = new SoundLoader(id, request, parent);
+ break;
+
+ case AssetType.VIDEO:
+ _loader = new VideoLoader(id, request, parent);
+ break;
+
+ case AssetType.GROUP:
+ _loader = new AssetLoader(id);
+ break;
+
+ default:
+ throw new AssetLoaderError(AssetLoaderError.ASSET_TYPE_NOT_RECOGNIZED);
+ }
+ }
+ }
+}
Oops, something went wrong.

0 comments on commit cf715b3

Please sign in to comment.