Dodanie aplikacji sorl.thumbnail i filebrowser.
[redakcja.git] / apps / filebrowser / media / filebrowser / uploadify / com / adobe / webapis / URLLoaderBase.as
diff --git a/apps/filebrowser/media/filebrowser/uploadify/com/adobe/webapis/URLLoaderBase.as b/apps/filebrowser/media/filebrowser/uploadify/com/adobe/webapis/URLLoaderBase.as
new file mode 100755 (executable)
index 0000000..fc0085c
--- /dev/null
@@ -0,0 +1,108 @@
+/*\r
+  Copyright (c) 2008, Adobe Systems Incorporated\r
+  All rights reserved.\r
+\r
+  Redistribution and use in source and binary forms, with or without \r
+  modification, are permitted provided that the following conditions are\r
+  met:\r
+\r
+  * Redistributions of source code must retain the above copyright notice, \r
+    this list of conditions and the following disclaimer.\r
+  \r
+  * Redistributions in binary form must reproduce the above copyright\r
+    notice, this list of conditions and the following disclaimer in the \r
+    documentation and/or other materials provided with the distribution.\r
+  \r
+  * Neither the name of Adobe Systems Incorporated nor the names of its \r
+    contributors may be used to endorse or promote products derived from \r
+    this software without specific prior written permission.\r
+\r
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS\r
+  IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\r
+  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r
+  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR \r
+  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\r
+  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\r
+  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\r
+  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\r
+  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\r
+  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r
+  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+*/\r
+\r
+package com.adobe.webapis\r
+{\r
+       import flash.events.IOErrorEvent;\r
+       import flash.events.SecurityErrorEvent;\r
+       import flash.events.ProgressEvent;\r
+       \r
+       import com.adobe.net.DynamicURLLoader;\r
+       \r
+               /**\r
+               *       Dispatched when data is \r
+               *       received as the download operation progresses.\r
+               *        \r
+               *       @eventType flash.events.ProgressEvent.PROGRESS\r
+               * \r
+               * @langversion ActionScript 3.0\r
+               * @playerversion Flash 9.0\r
+               */\r
+               [Event(name="progress", type="flash.events.ProgressEvent")]             \r
+       \r
+               /**\r
+               *       Dispatched if a call to the server results in a fatal \r
+               *       error that terminates the download.\r
+               * \r
+               *       @eventType flash.events.IOErrorEvent.IO_ERROR\r
+               * \r
+               * @langversion ActionScript 3.0\r
+               * @playerversion Flash 9.0\r
+               */\r
+               [Event(name="ioError", type="flash.events.IOErrorEvent")]               \r
+               \r
+               /**\r
+               *       A securityError event occurs if a call attempts to\r
+               *       load data from a server outside the security sandbox.\r
+               * \r
+               *       @eventType flash.events.SecurityErrorEvent.SECURITY_ERROR\r
+               * \r
+               * @langversion ActionScript 3.0\r
+               * @playerversion Flash 9.0\r
+               */\r
+               [Event(name="securityError", type="flash.events.SecurityErrorEvent")]   \r
+       \r
+       /**\r
+       *       Base class for services that utilize URLLoader\r
+       *       to communicate with remote APIs / Services.\r
+       * \r
+       * @langversion ActionScript 3.0\r
+       * @playerversion Flash 9.0\r
+       */\r
+       public class URLLoaderBase extends ServiceBase\r
+       {       \r
+               protected function getURLLoader():DynamicURLLoader\r
+               {\r
+                       var loader:DynamicURLLoader = new DynamicURLLoader();\r
+                               loader.addEventListener("progress", onProgress);\r
+                               loader.addEventListener("ioError", onIOError);\r
+                               loader.addEventListener("securityError", onSecurityError);\r
+                       \r
+                       return loader;                  \r
+               }               \r
+               \r
+               private function onIOError(event:IOErrorEvent):void\r
+               {\r
+                       dispatchEvent(event);\r
+               }                       \r
+               \r
+               private function onSecurityError(event:SecurityErrorEvent):void\r
+               {\r
+                       dispatchEvent(event);\r
+               }       \r
+               \r
+               private function onProgress(event:ProgressEvent):void\r
+               {\r
+                       dispatchEvent(event);\r
+               }       \r
+       }\r
+}
\ No newline at end of file