PageRenderTime 79ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/FD3/FlashDevelop/Bin/Debug/Library/AS3/frameworks/FlashIDE/fl/containers/UILoader.as

https://bitbucket.org/kkszysiu/flashdevelop
ActionScript | 211 lines | 69 code | 4 blank | 138 comment | 0 complexity | 69a34a0ae395527841f6bcea8e64f333 MD5 | raw file
  1. package fl.containers
  2. {
  3. import fl.core.InvalidationType;
  4. import fl.core.UIComponent;
  5. import fl.events.ComponentEvent;
  6. import flash.display.DisplayObject;
  7. import flash.display.Graphics;
  8. import flash.display.Loader;
  9. import flash.display.LoaderInfo;
  10. import flash.display.Shape;
  11. import flash.display.Sprite;
  12. import flash.events.Event;
  13. import flash.events.ProgressEvent;
  14. import flash.events.SecurityErrorEvent;
  15. import flash.events.IOErrorEvent;
  16. import flash.events.HTTPStatusEvent;
  17. import flash.net.URLRequest;
  18. import flash.system.ApplicationDomain;
  19. import flash.system.LoaderContext;
  20. import flash.utils.ByteArray;
  21. /**
  22. * Dispatched when content loading is complete. This event is dispatched * regardless of whether the load operation was triggered by an auto-load process or an explicit * call to the <code>load()</code> method. * * @eventType flash.events.Event.COMPLETE * * @includeExample examples/UILoader.complete.1.as -noswf * * @see #event:progress * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  23. */
  24. [Event("complete", type="flash.events.Event")]
  25. /**
  26. * Dispatched when the properties and methods of a loaded SWF file are accessible. * The following conditions must exist for this event to be dispatched: * <ul> * <li>All the properties and methods that are associated with the loaded object, * as well as those that are associated with the component, must be accessible.</li> * <li>The constructors for all child objects must have completed.</li> * </ul> * * @eventType flash.events.Event.INIT * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  27. */
  28. [Event("init", type="flash.events.Event")]
  29. /**
  30. * Dispatched after an input or output error occurs. * * @includeExample examples/UILoader.ioError.1.as -noswf * * @eventType flash.events.IOErrorEvent.IO_ERROR * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  31. */
  32. [Event("ioError", type="flash.events.IOErrorEvent")]
  33. /**
  34. * Dispatched after a network operation starts. * * @eventType flash.events.Event.OPEN * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  35. */
  36. [Event("open", type="flash.events.Event")]
  37. /**
  38. * Dispatched when content is loading. This event is dispatched regardless of * whether the load operation was triggered by an auto-load process or an explicit call to the * <code>load()</code> method. * * @includeExample examples/UILoader.progress.1.as -noswf * * @eventType flash.events.ProgressEvent.PROGRESS * * @see #event:complete * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  39. */
  40. [Event("progress", type="flash.events.ProgressEvent")]
  41. /**
  42. * Dispatched after the component is resized. * * @includeExample examples/UILoader.resize.1.as -noswf * * @eventType fl.events.ComponentEvent.RESIZE * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  43. */
  44. [Event("resize", type="fl.events.ComponentEvent")]
  45. /**
  46. * Dispatched after a security error occurs while content is loading. * * @eventType flash.events.SecurityErrorEvent.SECURITY_ERROR * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  47. */
  48. [Event("securityError", type="flash.events.SecurityErrorEvent")]
  49. /**
  50. * The UILoader class makes it possible to set content to load and to then * monitor the loading operation at run time. This class also handles the resizing * of the loaded content. If loading content from a different domain (sandbox), * security implications may mean content properties are inaccessible. Please * see the Loader class for more information. * * <p>Using ActionScript to set a property of the UILoader class * overrides the parameter of the same name that is set in the Property * inspector or Component inspector.</p> * * <p>This component wraps flash.display.Loader. The Loader class handles all the actual * loading; the UILoader just provides a visual display for the Loader object.</p> * * <p><strong>Note:</strong> When content is being loaded from a different * domain or <em>sandbox</em>, the properties of the content may be inaccessible * for security reasons. For more information about how domain security * affects the load process, see the Loader class.</p> * * @see flash.display.Loader Loader * * @includeExample examples/UILoaderExample.as -noswf * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  51. */
  52. public class UILoader extends UIComponent
  53. {
  54. /**
  55. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  56. */
  57. protected var _scaleContent : Boolean;
  58. /**
  59. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  60. */
  61. protected var _autoLoad : Boolean;
  62. /**
  63. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  64. */
  65. protected var contentInited : Boolean;
  66. /**
  67. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  68. */
  69. protected var _source : Object;
  70. /**
  71. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  72. */
  73. protected var loader : Loader;
  74. /**
  75. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  76. */
  77. protected var _maintainAspectRatio : Boolean;
  78. /**
  79. * @private * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  80. */
  81. protected var contentClip : Sprite;
  82. /**
  83. * @private * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  84. */
  85. private static var defaultStyles : Object;
  86. /**
  87. * Gets or sets a value that indicates whether the UILoader instance automatically * loads the specified content. A value of <code>true</code> indicates that the UILoader * automatically loads the content; a value of <code>false</code> indicates that content * is not loaded until the <code>load()</code> method is called. * * @default true * * @includeExample examples/UILoader.autoLoad.1.as -noswf * * @see #load() * @see #source * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  88. */
  89. public function get autoLoad () : Boolean;
  90. /**
  91. * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  92. */
  93. public function set autoLoad (value:Boolean) : void;
  94. /**
  95. * Gets or sets a value that indicates whether to automatically scale the image to * the size of the UILoader instance. A value of <code>true</code> indicates that the * image is automatically scaled to the size of the UILoader instance; a value of * <code>false</code> indicates that the loaded content is automatically scaled * to its default size. * * @default true * * @includeExample examples/UILoader.scaleContent.1.as -noswf * * @see #maintainAspectRatio * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  96. */
  97. public function get scaleContent () : Boolean;
  98. /**
  99. * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  100. */
  101. public function set scaleContent (value:Boolean) : void;
  102. /**
  103. * Gets or sets a value that indicates whether to maintain * the aspect ratio that was used in the original image or to resize * the image at the curent width and height of the UILoader component. * A value of <code>true</code> indicates that the original aspect ratio * is to be maintained; a value of <code>false</code> indicates that the * loaded content should be resized to the current dimensions of the UILoader. * * <p>To use this property, you must set the <code>scaleContent</code> property to * <code>false</code>; otherwise, this property is ignored.</p> * * @default true * * @includeExample examples/UILoader.maintainAspectRatio.1.as -noswf * * @see #scaleContent * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  104. */
  105. public function get maintainAspectRatio () : Boolean;
  106. /**
  107. * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  108. */
  109. public function set maintainAspectRatio (value:Boolean) : void;
  110. /**
  111. * @copy ScrollPane#bytesLoaded * * @default 0 * * @includeExample examples/UILoader.progress.1.as -noswf * * @see #bytesTotal * @see #percentLoaded * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  112. */
  113. public function get bytesLoaded () : uint;
  114. /**
  115. * @copy ScrollPane#bytesTotal * * @default 0 * * @includeExample examples/UILoader.progress.1.as -noswf * * @see #bytesLoaded * @see #percentLoaded * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  116. */
  117. public function get bytesTotal () : uint;
  118. /**
  119. * Contains the root display object of the SWF file or image file (a JPEG, PNG, or GIF format file) * that was loaded by using the <code>load()</code> method or setting the <code>source</code> property. * The value is <code>undefined</code> until the load begins. Set the properties for the content * within an event handler function for the <code>complete</code> event. * * @default null * * @includeExample examples/UILoader.content.1.as -noswf * * @see #event:complete * @see #load() * @see #source * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  120. */
  121. public function get content () : DisplayObject;
  122. /**
  123. * @copy fl.containers.ScrollPane#source * * @default null * * @includeExample examples/UILoader.source.1.as -noswf * * @see #autoLoad * @see #load() * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  124. */
  125. public function get source () : Object;
  126. /**
  127. * @private (setter) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  128. */
  129. public function set source (value:Object) : void;
  130. /**
  131. * @copy ScrollPane#percentLoaded * * @default 0 * * @includeExample examples/UILoader.progress.1.as -noswf * * @see #bytesLoaded * @see #bytesTotal * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  132. */
  133. public function get percentLoaded () : Number;
  134. /**
  135. * @copy fl.core.UIComponent#getStyleDefinition() * * @see fl.core.UIComponent#getStyle() UIComponent.getStyle() * @see fl.core.UIComponent#setStyle() UIComponent.setStyle() * @see fl.managers.StyleManager StyleManager * * @includeExample ../core/examples/UIComponent.getStyleDefinition.1.as -noswf * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  136. */
  137. public static function getStyleDefinition () : Object;
  138. /**
  139. * Creates a new UILoader component instance. * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  140. */
  141. public function UILoader ();
  142. /**
  143. * Resizes the component to the requested size. If the <code>scaleContent</code> * property is set to <code>true</code>, the UILoader is not resized. * * @param w The width of the component, in pixels. * @param h The height of the component, in pixels. * * @includeExample examples/UILoader.setSize.1.as -noswf * * @see #scaleContent * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  144. */
  145. public function setSize (w:Number, h:Number) : void;
  146. /**
  147. * Loads binary data that is stored in a ByteArray object. * * @param bytes A ByteArray object that contains a file in one of the formats supported * by the Loader class: SWF, GIF, JPEG, or PNG. * * @param context Only the <code>applicationDomain</code> property of the LoaderContext * object applies; the <code>checkPolicyFile</code> and <code>securityDomain</code> * properties of the LoaderContext object do not apply. * * @throws ArgumentError The <code>length</code> property of the ByteArray object is 0. * * @throws IllegalOperationError The <code>checkPolicyFile</code> or <code>securityDomain</code> * property of the <code>context</code> parameter is non-null. * * @throws SecurityError The <code>applicationDomain</code> property of the * <code>context</code> property that was provided is from a domain that is not allowed. * * @includeExample examples/UILoader.loadBytes.1.as -noswf * * @see #source * @see flash.display.Loader#loadBytes() Loader.loadBytes() * @see flash.system.LoaderContext LoaderContext * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  148. */
  149. public function loadBytes (bytes:ByteArray, context:LoaderContext = null) : void;
  150. /**
  151. * Loads the specified content or, if no content is specified, loads the * content from the location identified by the <code>source</code> property. * * By default, the LoaderContext object uses the current domain as the * application domain. To specify a different application domain, to check * a policy file, or to change the security domain, initialize a new LoaderContext * object and pass it to this method. * * <p>By default, the context property uses the current domain. * To specify a different ApplicationDomain, check a policy file, or * change the SecurityDomain, pass a new LoaderContext object.</p> * * @param request The URLRequest object that identifies the location from * which to load the content. If this value is not specified, * the current value of the <code>source</code> property is * used as the content location. * @param context The LoaderContext object that sets the context of the load operation. * @param context A LoaderContext object used to specify the context of the load . * * @includeExample examples/UILoader.load.1.as -noswf * @includeExample examples/UILoader.load.2.as -noswf * * @see #autoLoad * @see #close() * @see #source * @see #unload() * @see flash.system.ApplicationDomain * @see flash.system.LoaderContext * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  152. */
  153. public function load (request:URLRequest = null, context:LoaderContext = null) : void;
  154. /**
  155. * Removes a child of this UILoader object that was loaded by using * either the <code>load()</code> method or the <code>source</code> * property. * * @includeExample examples/UILoader.unload.1.as -noswf * * @see #load() * @see #source * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  156. */
  157. public function unload () : void;
  158. /**
  159. * Cancels a <code>load()</code> method operation that is currently in progress for the * Loader instance. The <code>load()</code> method can also be called from the <code>source</code> parameter. * * @throws Error The URLStream object does not have an open stream. * * @includeExample examples/UILoader.close.1.as -noswf * * @see #load() * @see #source * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  160. */
  161. public function close () : void;
  162. /**
  163. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  164. */
  165. protected function _unload (throwError:Boolean = false) : void;
  166. /**
  167. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  168. */
  169. protected function initLoader () : void;
  170. /**
  171. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  172. */
  173. protected function handleComplete (event:Event) : void;
  174. /**
  175. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  176. */
  177. protected function passEvent (event:Event) : void;
  178. /**
  179. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  180. */
  181. protected function handleError (event:Event) : void;
  182. /**
  183. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  184. */
  185. protected function handleInit (event:Event) : void;
  186. /**
  187. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  188. */
  189. protected function clearLoadEvents () : void;
  190. /**
  191. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  192. */
  193. protected function draw () : void;
  194. /**
  195. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  196. */
  197. protected function drawLayout () : void;
  198. /**
  199. * @private (protected) * * @langversion 3.0 * @playerversion Flash 9.0.28.0
  200. */
  201. protected function sizeContent (target:DisplayObject, contentWidth:Number, contentHeight:Number, targetWidth:Number, targetHeight:Number) : void;
  202. /**
  203. * @private (protected)
  204. */
  205. protected function configUI () : void;
  206. }
  207. }