1//////////////////////////////////////////////////////////////////////////////// 2// 3// ADOBE SYSTEMS INCORPORATED 4// Copyright 2005-2006 Adobe Systems Incorporated 5// All Rights Reserved. 6// 7// NOTICE: Adobe permits you to use, modify, and distribute this file 8// in accordance with the terms of the license agreement accompanying it. 9// 10//////////////////////////////////////////////////////////////////////////////// 11 12package mx.events 13{ 14 15import flash.display.LoaderInfo; 16import flash.events.Event; 17import flash.events.ProgressEvent; 18import flash.net.URLRequest; 19 20/** 21 * The RSLEvent class represents an event object used by the 22 * DownloadProgressBar class when an RSL is being downloaded by the Preloader class. 23 * 24 * @see mx.preloaders.DownloadProgressBar 25 * @see mx.preloaders.Preloader 26 * 27 * @langversion 3.0 28 * @playerversion Flash 9 29 * @playerversion AIR 1.1 30 * @productversion Flex 3 31 */ 32public class RSLEvent extends ProgressEvent 33{ 34 include "../core/Version.as"; 35 36 //-------------------------------------------------------------------------- 37 // 38 // Class constants 39 // 40 //-------------------------------------------------------------------------- 41 42 /** 43 * The <code>RSLEvent.RSL_ADD_PRELOADED</code> constant defines the value of the 44 * <code>type</code> property of the event object for an 45 * <code>rslAddPreloaded</code> event. This event is dispatched from an 46 * IFlexModuleFactory after a child IFlexModuleFactory preloads an RSL 47 * into its application domain. 48 * 49 * <p>The properties of the event object have the following values:</p> 50 * <table class="innertable"> 51 * <tr><th>Property</th><th>Value</th></tr> 52 * <tr><td><code>bubbles</code></td><td>false</td></tr> 53 * <tr><td><code>cancelable</code></td><td>false</td></tr> 54 * <tr><td><code>currentTarget</code></td><td>The Object that defines the 55 * event listener that handles the event. For example, if you use 56 * <code>myButton.addEventListener()</code> to register an event listener, 57 * myButton is the value of the <code>currentTarget</code>. </td></tr> 58 * <tr><td><code>loaderInfo</code></td><td>The LoaderInfo instance 59 * associated with this RSL.</td></tr> 60 * <tr><td><code>target</code></td><td>The Object that dispatched the event; 61 * it is not always the Object listening for the event. 62 * Use the <code>currentTarget</code> property to always access the 63 * Object listening for the event.</td></tr> 64 * </table> 65 * 66 * @eventType rslAddPreloaded 67 * 68 * @langversion 3.0 69 * @playerversion Flash 10 70 * @playerversion AIR 1.5 71 * @productversion Flex 4.5 72 */ 73 public static const RSL_ADD_PRELOADED:String = "rslAddPreloaded"; 74 75 /** 76 * Dispatched when the RSL has finished downloading. 77 * The <code>RSLEvent.RSL_COMPLETE</code> constant defines the value of the 78 * <code>type</code> property of the event object for a <code>rslComplete</code> event. 79 * 80 * <p>The properties of the event object have the following values:</p> 81 * <table class="innertable"> 82 * <tr><th>Property</th><th>Value</th></tr> 83 * <tr><td><code>bubbles</code></td><td>false</td></tr> 84 * <tr><td><code>bytesLoaded</code></td><td>The number of bytes loaded.</td></tr> 85 * <tr><td><code>bytesTotal</code></td><td>The total number of bytes to load.</td></tr> 86 * <tr><td><code>cancelable</code></td><td>false</td></tr> 87 * <tr><td><code>currentTarget</code></td><td>The Object that defines the 88 * event listener that handles the event. For example, if you use 89 * <code>myButton.addEventListener()</code> to register an event listener, 90 * myButton is the value of the <code>currentTarget</code>. </td></tr> 91 * <tr><td><code>errorText</code></td><td>Empty</td></tr> 92 * <tr><td><code>isResourceModule</code></td><td>True if we loaded a resourceModule 93 * instead of an RSL</td></tr> 94 * <tr><td><code>rslIndex</code></td><td>The index number of the RSL 95 * currently being downloaded. </td></tr> 96 * <tr><td><code>rslTotal</code></td><td>The total number of RSLs 97 * being downloaded. </td></tr> 98 * <tr><td><code>target</code></td><td>The Object that dispatched the event; 99 * it is not always the Object listening for the event. 100 * Use the <code>currentTarget</code> property to always access the 101 * Object listening for the event.</td></tr> 102 * <tr><td><code>url</code></td><td>The URLRequest object that represents 103 * the location of the RSL being downloaded.</td></tr> 104 * </table> 105 * 106 * @eventType rslComplete 107 * 108 * @langversion 3.0 109 * @playerversion Flash 9 110 * @playerversion AIR 1.1 111 * @productversion Flex 3 112 */ 113 public static const RSL_COMPLETE:String = "rslComplete"; 114 115 /** 116 * Dispatched when there is an error downloading the RSL. 117 * The <code>RSLEvent.RSL_ERROR</code> constant defines the value of the 118 * <code>type</code> property of the event object for a <code>rslError</code> event. 119 * 120 * <p>The properties of the event object have the following values:</p> 121 * <table class="innertable"> 122 * <tr><th>Property</th><th>Value</th></tr> 123 * <tr><td><code>bubbles</code></td><td>false</td></tr> 124 * <tr><td><code>bytesLoaded</code></td><td>Empty</td></tr> 125 * <tr><td><code>bytesTotal</code></td><td>Empty</td></tr> 126 * <tr><td><code>cancelable</code></td><td>false</td></tr> 127 * <tr><td><code>currentTarget</code></td><td>The Object that defines the 128 * event listener that handles the event. For example, if you use 129 * <code>myButton.addEventListener()</code> to register an event listener, 130 * myButton is the value of the <code>currentTarget</code>. </td></tr> 131 * <tr><td><code>errorText</code></td>An error message.<td></td></tr> 132 * <tr><td><code>isResourceModule</code></td><td>True if we loaded a resourceModule 133 * instead of an RSL</td></tr> 134 * <tr><td><code>rslIndex</code></td><td>The index number of the RSL 135 * currently being downloaded. </td></tr> 136 * <tr><td><code>rslTotal</code></td><td>The total number of RSLs 137 * being downloaded. </td></tr> 138 * <tr><td><code>target</code></td><td>The Object that dispatched the event; 139 * it is not always the Object listening for the event. 140 * Use the <code>currentTarget</code> property to always access the 141 * Object listening for the event.</td></tr> 142 * <tr><td><code>url</code></td><td>The URLRequest object that represents 143 * the location of the RSL being downloaded.</td></tr> 144 * </table> 145 * 146 * @eventType rslError 147 * 148 * @langversion 3.0 149 * @playerversion Flash 9 150 * @playerversion AIR 1.1 151 * @productversion Flex 3 152 */ 153 public static const RSL_ERROR:String = "rslError"; 154 155 /** 156 * Dispatched when the RSL is downloading. 157 * The <code>RSLEvent.RSL_PROGRESS</code> constant defines the value of the 158 * <code>type</code> property of the event object for a <code>rslProgress</code> event. 159 * 160 * <p>The properties of the event object have the following values:</p> 161 * <table class="innertable"> 162 * <tr><th>Property</th><th>Value</th></tr> 163 * <tr><td><code>bubbles</code></td><td>false</td></tr> 164 * <tr><td><code>bytesLoaded</code></td><td>The number of bytes loaded.</td></tr> 165 * <tr><td><code>bytesTotal</code></td><td>The total number of bytes to load.</td></tr> 166 * <tr><td><code>cancelable</code></td><td>false</td></tr> 167 * <tr><td><code>currentTarget</code></td><td>The Object that defines the 168 * event listener that handles the event. For example, if you use 169 * <code>myButton.addEventListener()</code> to register an event listener, 170 * myButton is the value of the <code>currentTarget</code>. </td></tr> 171 * <tr><td><code>errorText</code></td>Empty<td></td></tr> 172 * <tr><td><code>isResourceModule</code></td><td>True if we loaded a resourceModule 173 * instead of an RSL</td></tr> 174 * <tr><td><code>rslIndex</code></td><td>The index number of the RSL 175 * currently being downloaded. </td></tr> 176 * <tr><td><code>rslTotal</code></td><td>The total number of RSLs 177 * being downloaded. </td></tr> 178 * <tr><td><code>target</code></td><td>The Object that dispatched the event; 179 * it is not always the Object listening for the event. 180 * Use the <code>currentTarget</code> property to always access the 181 * Object listening for the event.</td></tr> 182 * <tr><td><code>url</code></td><td>The URLRequest object that represents 183 * the location of the RSL being downloaded.</td></tr> 184 * </table> 185 * 186 * @eventType rslProgress 187 * 188 * @langversion 3.0 189 * @playerversion Flash 9 190 * @playerversion AIR 1.1 191 * @productversion Flex 3 192 */ 193 public static const RSL_PROGRESS:String = "rslProgress"; 194 195 //-------------------------------------------------------------------------- 196 // 197 // Constructor 198 // 199 //-------------------------------------------------------------------------- 200 201 /** 202 * Constructor. 203 * 204 * @param type The type of the event. Possible values are: 205 * <ul> 206 * <li>"rslProgress" (<code>RSLEvent.RSL_PROGRESS</code>);</li> 207 * <li>"rslComplete" (<code>RSLEvent.RSL_COMPLETE</code>);</li> 208 * <li>"rslError" (<code>RSLEvent.RSL_ERROR</code>);</li> 209 * </ul> 210 * 211 * @param bubbles Determines whether the Event object participates in the bubbling stage of the event flow. 212 * 213 * @param cancelable Determines whether the Event object can be cancelled. 214 * 215 * @param bytesLoaded The number of bytes loaded at the time the listener processes the event. 216 * 217 * @param bytesTotal The total number of bytes that will ultimately be loaded if the loading process succeeds. 218 * 219 * @param rslIndex The index number of the RSL relative to the total. This should be a value between 0 and <code>total - 1</code>. 220 * 221 * @param rslTotal The total number of RSLs being loaded. 222 * 223 * @param url The location of the RSL. 224 * 225 * @param errorText The error message of the error when type is RSLEvent.RSL_ERROR. 226 * 227 * @param isResourceModule True if the event occurred when loading a ResourceModule. 228 * 229 * @param loaderInfo The LoaderInfo object associated with this event. 230 * 231 * @tiptext Constructor for <code>RSLEvent</code> objects. 232 * 233 * @langversion 3.0 234 * @playerversion Flash 9 235 * @playerversion AIR 1.1 236 * @productversion Flex 3 237 */ 238 public function RSLEvent(type:String, bubbles:Boolean = false, 239 cancelable:Boolean = false, 240 bytesLoaded:int = -1, bytesTotal:int = -1, 241 rslIndex:int = -1, rslTotal:int = -1, 242 url:URLRequest = null, errorText:String = null, 243 isResourceModule:Boolean = false, 244 loaderInfo:LoaderInfo = null) 245 { 246 super(type, bubbles, cancelable, bytesLoaded, bytesTotal); 247 248 this.rslIndex = rslIndex; 249 this.rslTotal = rslTotal; 250 this.url = url; 251 this.errorText = errorText; 252 this.isResourceModule = isResourceModule; 253 this.loaderInfo = loaderInfo; 254 } 255 256 //-------------------------------------------------------------------------- 257 // 258 // Properties 259 // 260 //-------------------------------------------------------------------------- 261 262 //---------------------------------- 263 // errorText 264 //---------------------------------- 265 266 /** 267 * The error message if the type is RSL_ERROR; otherwise, it is null; 268 * 269 * @langversion 3.0 270 * @playerversion Flash 9 271 * @playerversion AIR 1.1 272 * @productversion Flex 3 273 */ 274 public var errorText:String; 275 276 //---------------------------------- 277 // isResourceModule 278 //---------------------------------- 279 280 /** 281 * True if the event is for loading a resourceModule instead of an RSL 282 */ 283 public var isResourceModule:Boolean; 284 285 //---------------------------------- 286 // loaderInfo 287 //---------------------------------- 288 289 /** 290 * The LoaderInfo object associated with this event. This is only set in the 291 * RSLEvent.RSL_COMPLETE event. Otherwise loaderInfo will be null. 292 */ 293 public var loaderInfo:LoaderInfo; 294 295 //---------------------------------- 296 // rslIndex 297 //---------------------------------- 298 299 /** 300 * The index number of the RSL currently being downloaded. 301 * This is a number between 0 and <code>rslTotal - 1</code>. 302 * 303 * @langversion 3.0 304 * @playerversion Flash 9 305 * @playerversion AIR 1.1 306 * @productversion Flex 3 307 */ 308 public var rslIndex:int; 309 310 //---------------------------------- 311 // rslTotal 312 //---------------------------------- 313 314 /** 315 * The total number of RSLs being downloaded by the preloader 316 * 317 * @langversion 3.0 318 * @playerversion Flash 9 319 * @playerversion AIR 1.1 320 * @productversion Flex 3 321 */ 322 public var rslTotal:int; 323 324 //---------------------------------- 325 // url 326 //---------------------------------- 327 328 /** 329 * The URLRequest object that represents the location 330 * of the RSL being downloaded. 331 * 332 * @langversion 3.0 333 * @playerversion Flash 9 334 * @playerversion AIR 1.1 335 * @productversion Flex 3 336 */ 337 public var url:URLRequest; 338 339 //-------------------------------------------------------------------------- 340 // 341 // Overridden properties: Event 342 // 343 //-------------------------------------------------------------------------- 344 345 /** 346 * @private 347 */ 348 override public function clone():Event 349 { 350 return new RSLEvent(type, bubbles, cancelable, 351 bytesLoaded, bytesTotal, rslIndex, 352 rslTotal, url, errorText, isResourceModule, 353 loaderInfo); 354 } 355} 356 357} 358