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.events.Event; 16import flash.events.ProgressEvent; 17import flash.net.URLRequest; 18import flash.display.LoaderInfo; 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 */ 27public class RSLEvent extends ProgressEvent 28{ 29 include "../core/Version.as"; 30 31 //-------------------------------------------------------------------------- 32 // 33 // Class constants 34 // 35 //-------------------------------------------------------------------------- 36 37 /** 38 * Dispatched when the RSL has finished downloading. 39 * The <code>RSLEvent.RSL_COMPLETE</code> constant defines the value of the 40 * <code>type</code> property of the event object for a <code>rslComplete</code> event. 41 * 42 * <p>The properties of the event object have the following values:</p> 43 * <table class="innertable"> 44 * <tr><th>Property</th><th>Value</th></tr> 45 * <tr><td><code>bubbles</code></td><td>false</td></tr> 46 * <tr><td><code>bytesLoaded</code></td><td>The number of bytes loaded.</td></tr> 47 * <tr><td><code>bytesTotal</code></td><td>The total number of bytes to load.</td></tr> 48 * <tr><td><code>cancelable</code></td><td>false</td></tr> 49 * <tr><td><code>currentTarget</code></td><td>The Object that defines the 50 * event listener that handles the event. For example, if you use 51 * <code>myButton.addEventListener()</code> to register an event listener, 52 * myButton is the value of the <code>currentTarget</code>. </td></tr> 53 * <tr><td><code>errorText</code></td><td>Empty</td></tr> 54 * <tr><td><code>rslIndex</code></td><td>The index number of the RSL 55 * currently being downloaded. </td></tr> 56 * <tr><td><code>rslTotal</code></td><td>The total number of RSLs 57 * being downloaded. </td></tr> 58 * <tr><td><code>target</code></td><td>The Object that dispatched the event; 59 * it is not always the Object listening for the event. 60 * Use the <code>currentTarget</code> property to always access the 61 * Object listening for the event.</td></tr> 62 * <tr><td><code>url</code></td><td>The URLRequest object that represents 63 * the location of the RSL being downloaded.</td></tr> 64 * </table> 65 * 66 * @eventType rslComplete 67 */ 68 public static const RSL_COMPLETE:String = "rslComplete"; 69 70 /** 71 * Dispatched when there is an error downloading the RSL. 72 * The <code>RSLEvent.RSL_ERROR</code> constant defines the value of the 73 * <code>type</code> property of the event object for a <code>rslError</code> event. 74 * 75 * <p>The properties of the event object have the following values:</p> 76 * <table class="innertable"> 77 * <tr><th>Property</th><th>Value</th></tr> 78 * <tr><td><code>bubbles</code></td><td>false</td></tr> 79 * <tr><td><code>bytesLoaded</code></td><td>Empty</td></tr> 80 * <tr><td><code>bytesTotal</code></td><td>Empty</td></tr> 81 * <tr><td><code>cancelable</code></td><td>false</td></tr> 82 * <tr><td><code>currentTarget</code></td><td>The Object that defines the 83 * event listener that handles the event. For example, if you use 84 * <code>myButton.addEventListener()</code> to register an event listener, 85 * myButton is the value of the <code>currentTarget</code>. </td></tr> 86 * <tr><td><code>errorText</code></td>An error message.<td></td></tr> 87 * <tr><td><code>rslIndex</code></td><td>The index number of the RSL 88 * currently being downloaded. </td></tr> 89 * <tr><td><code>rslTotal</code></td><td>The total number of RSLs 90 * being downloaded. </td></tr> 91 * <tr><td><code>target</code></td><td>The Object that dispatched the event; 92 * it is not always the Object listening for the event. 93 * Use the <code>currentTarget</code> property to always access the 94 * Object listening for the event.</td></tr> 95 * <tr><td><code>url</code></td><td>The URLRequest object that represents 96 * the location of the RSL being downloaded.</td></tr> 97 * </table> 98 * 99 * @eventType rslError 100 */ 101 public static const RSL_ERROR:String = "rslError"; 102 103 /** 104 * Dispatched when the RSL is downloading. 105 * The <code>RSLEvent.RSL_PROGRESS</code> constant defines the value of the 106 * <code>type</code> property of the event object for a <code>rslProgress</code> event. 107 * 108 * <p>The properties of the event object have the following values:</p> 109 * <table class="innertable"> 110 * <tr><th>Property</th><th>Value</th></tr> 111 * <tr><td><code>bubbles</code></td><td>false</td></tr> 112 * <tr><td><code>bytesLoaded</code></td><td>The number of bytes loaded.</td></tr> 113 * <tr><td><code>bytesTotal</code></td><td>The total number of bytes to load.</td></tr> 114 * <tr><td><code>cancelable</code></td><td>false</td></tr> 115 * <tr><td><code>currentTarget</code></td><td>The Object that defines the 116 * event listener that handles the event. For example, if you use 117 * <code>myButton.addEventListener()</code> to register an event listener, 118 * myButton is the value of the <code>currentTarget</code>. </td></tr> 119 * <tr><td><code>errorText</code></td>Empty<td></td></tr> 120 * <tr><td><code>rslIndex</code></td><td>The index number of the RSL 121 * currently being downloaded. </td></tr> 122 * <tr><td><code>rslTotal</code></td><td>The total number of RSLs 123 * being downloaded. </td></tr> 124 * <tr><td><code>target</code></td><td>The Object that dispatched the event; 125 * it is not always the Object listening for the event. 126 * Use the <code>currentTarget</code> property to always access the 127 * Object listening for the event.</td></tr> 128 * <tr><td><code>url</code></td><td>The URLRequest object that represents 129 * the location of the RSL being downloaded.</td></tr> 130 * </table> 131 * 132 * @eventType rslProgress 133 */ 134 public static const RSL_PROGRESS:String = "rslProgress"; 135 136 //-------------------------------------------------------------------------- 137 // 138 // Constructor 139 // 140 //-------------------------------------------------------------------------- 141 142 /** 143 * Constructor. 144 * 145 * @param type The type of the event. Possible values are: 146 * <ul> 147 * <li>"rslProgress" (<code>RSLEvent.RSL_PROGRESS</code>);</li> 148 * <li>"rslComplete" (<code>RSLEvent.RSL_COMPLETE</code>);</li> 149 * <li>"rslError" (<code>RSLEvent.RSL_ERROR</code>);</li> 150 * </ul> 151 * 152 * @param bubbles Determines whether the Event object participates in the bubbling stage of the event flow. 153 * 154 * @param cancelable Determines whether the Event object can be cancelled. 155 * 156 * @param bytesLoaded The number of bytes loaded at the time the listener processes the event. 157 * 158 * @param bytesTotal The total number of bytes that will ultimately be loaded if the loading process succeeds. 159 * 160 * @param rslIndex The index number of the RSL relative to the total. This should be a value between 0 and <code>total - 1</code>. 161 * 162 * @param rslTotal The total number of RSLs being loaded. 163 * 164 * @param url The location of the RSL. 165 * 166 * @param errorText The error message of the error when type is RSLEvent.RSL_ERROR. 167 * 168 * @tiptext Constructor for <code>RSLEvent</code> objects. 169 */ 170 public function RSLEvent(type:String, bubbles:Boolean = false, 171 cancelable:Boolean = false, 172 bytesLoaded:int = -1, bytesTotal:int = -1, 173 rslIndex:int = -1, rslTotal:int = -1, 174 url:URLRequest = null, errorText:String = null) 175 { 176 super(type, bubbles, cancelable, bytesLoaded, bytesTotal); 177 178 this.rslIndex = rslIndex; 179 this.rslTotal = rslTotal; 180 this.url = url; 181 this.errorText = errorText; 182 } 183 184 //-------------------------------------------------------------------------- 185 // 186 // Properties 187 // 188 //-------------------------------------------------------------------------- 189 190 //---------------------------------- 191 // errorText 192 //---------------------------------- 193 194 /** 195 * The error message if the type is RSL_ERROR; otherwise, it is null; 196 */ 197 public var errorText:String; 198 199 //---------------------------------- 200 // loaderInfo 201 //---------------------------------- 202 203 /** 204 * The loaderInfo associated with this event. This is only set in the 205 * RSLEvent.RSL_COMPLETE event. Otherwise loaderInfo will be null. 206 */ 207 public var loaderInfo:LoaderInfo; 208 209 //---------------------------------- 210 // rslIndex 211 //---------------------------------- 212 213 /** 214 * The index number of the RSL currently being downloaded. 215 * This is a number between 0 and <code>rslTotal - 1</code>. 216 */ 217 public var rslIndex:int; 218 219 //---------------------------------- 220 // rslTotal 221 //---------------------------------- 222 223 /** 224 * The total number of RSLs being downloaded by the preloader 225 */ 226 public var rslTotal:int; 227 228 //---------------------------------- 229 // url 230 //---------------------------------- 231 232 /** 233 * The URLRequest object that represents the location 234 * of the RSL being downloaded. 235 */ 236 public var url:URLRequest; 237 238 //-------------------------------------------------------------------------- 239 // 240 // Overridden properties: Event 241 // 242 //-------------------------------------------------------------------------- 243 244 /** 245 * @private 246 */ 247 override public function clone():Event 248 { 249 return new RSLEvent(type, bubbles, cancelable, 250 bytesLoaded, bytesTotal, rslIndex, 251 rslTotal, url, errorText); 252 } 253} 254 255} 256