PageRenderTime 42ms CodeModel.GetById 20ms app.highlight 3ms RepoModel.GetById 17ms app.codeStats 0ms

/src/away3d/events/LoaderEvent.as

http://github.com/away3d/away3d-core-fp11
ActionScript | 97 lines | 45 code | 12 blank | 40 comment | 0 complexity | 41a1794d0f1d446c248f42f5430924af MD5 | raw file
 1package away3d.events
 2{
 3	import flash.events.Event;
 4	
 5	/**
 6	 * LoaderEvent is an Event dispatched to notify changes in loading state.
 7	 */
 8	public class LoaderEvent extends Event
 9	{
10		/**
11		 * Dispatched when loading of a asset failed.
12		 * Such as wrong parser type, unsupported extensions, parsing errors, malformated or unsupported 3d file etc..
13		 */
14		public static const LOAD_ERROR:String = "loadError";
15		
16		/**
17		 * Dispatched when a resource and all of its dependencies is retrieved.
18		 */
19		public static const RESOURCE_COMPLETE:String = "resourceComplete";
20		
21		/**
22		 * Dispatched when a resource's dependency is retrieved and resolved.
23		 */
24		public static const DEPENDENCY_COMPLETE:String = "dependencyComplete";
25		
26		private var _url:String;
27		private var _message:String;
28		private var _isDependency:Boolean;
29		private var _isDefaultPrevented:Boolean;
30		
31		/**
32		 * Create a new LoaderEvent object.
33		 * @param type The event type.
34		 * @param resource The loaded or parsed resource.
35		 * @param url The url of the loaded resource.
36		 */
37		public function LoaderEvent(type:String, url:String = null, isDependency:Boolean = false, errmsg:String = null)
38		{
39			super(type);
40			_url = url;
41			_message = errmsg;
42			_isDependency = isDependency;
43		}
44		
45		/**
46		 * The url of the loaded resource.
47		 */
48		public function get url():String
49		{
50			return _url;
51		}
52		
53		/**
54		 * The error string on loadError.
55		 */
56		public function get message():String
57		{
58			return _message;
59		}
60		
61		/**
62		 * Indicates whether the event occurred while loading a dependency, as opposed
63		 * to the base file. Dependencies can be textures or other files that are
64		 * referenced by the base file.
65		 */
66		public function get isDependency():Boolean
67		{
68			return _isDependency;
69		}
70		
71		/**
72		 * @inheritDoc
73		 */
74		public override function preventDefault():void
75		{
76			_isDefaultPrevented = true;
77		}
78		
79		/**
80		 * @inheritDoc
81		 */
82		public override function isDefaultPrevented():Boolean
83		{
84			return _isDefaultPrevented;
85		}
86		
87		/**
88		 * Clones the current event.
89		 * @return An exact duplicate of the current event.
90		 */
91		public override function clone():Event
92		{
93			return new LoaderEvent(type, _url, _isDependency, _message);
94		}
95	
96	}
97}