/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

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