1/*
2 * jPlayer Plugin for jQuery JavaScript Library
3 * http://www.jplayer.org
4 *
5 * Copyright (c) 2009 - 2014 Happyworm Ltd
6 * Licensed under the MIT license.
7 * http://opensource.org/licenses/MIT
8 *
9 * Author: Mark J Panaghiston
10 * Date: 15th December 2013
11 */
12
13package happyworm.jPlayer {
14	import flash.events.Event;
15
16	public class JplayerEvent extends Event {
17
18		// The event strings must match those in the JavaScript's $.jPlayer.event object
19
20		public static const JPLAYER_READY:String = "jPlayer_ready";
21		public static const JPLAYER_FLASHRESET:String = "jPlayer_flashreset"; // Handled in JavaScript
22		public static const JPLAYER_RESIZE:String = "jPlayer_resize"; // Handled in JavaScript
23		public static const JPLAYER_REPEAT:String = "jPlayer_repeat"; // Handled in JavaScript
24		public static const JPLAYER_CLICK:String = "jPlayer_click";
25		public static const JPLAYER_ERROR:String = "jPlayer_error";
26		public static const JPLAYER_WARNING:String = "jPlayer_warning"; // Currently not used by the flash solution
27
28		public static const JPLAYER_LOADSTART:String = "jPlayer_loadstart";
29		public static const JPLAYER_PROGRESS:String = "jPlayer_progress";
30		public static const JPLAYER_SUSPEND:String = "jPlayer_suspend"; // Not implemented
31		public static const JPLAYER_ABORT:String = "jPlayer_abort"; // Not implemented
32		public static const JPLAYER_EMPTIED:String = "jPlayer_emptied"; // Not implemented
33		public static const JPLAYER_STALLED:String = "jPlayer_stalled"; // Not implemented
34		public static const JPLAYER_PLAY:String = "jPlayer_play";
35		public static const JPLAYER_PAUSE:String = "jPlayer_pause";
36		public static const JPLAYER_LOADEDMETADATA:String = "jPlayer_loadedmetadata";
37		public static const JPLAYER_LOADEDDATA:String = "jPlayer_loadeddata"; // Not implemented
38		public static const JPLAYER_WAITING:String = "jPlayer_waiting"; // Not implemented (Done in: MP3)
39		public static const JPLAYER_PLAYING:String = "jPlayer_playing"; // Not implemented (Done in: MP3)
40		public static const JPLAYER_CANPLAY:String = "jPlayer_canplay"; // Not implemented (Done in: MP3)
41		public static const JPLAYER_CANPLAYTHROUGH:String = "jPlayer_canplaythrough"; // Not implemented (Done in: MP3)
42		public static const JPLAYER_SEEKING:String = "jPlayer_seeking";
43		public static const JPLAYER_SEEKED:String = "jPlayer_seeked";
44		public static const JPLAYER_TIMEUPDATE:String = "jPlayer_timeupdate";
45		public static const JPLAYER_ENDED:String = "jPlayer_ended";
46		public static const JPLAYER_RATECHANGE:String = "jPlayer_ratechange"; // Not implemented
47		public static const JPLAYER_DURATIONCHANGE:String = "jPlayer_durationchange"; // Not implemented (Done in: MP3)
48		public static const JPLAYER_VOLUMECHANGE:String = "jPlayer_volumechange"; // See JavaScript
49
50		// Events used internal to jPlayer's Flash.
51		public static const DEBUG_MSG:String = "debug_msg";
52
53		public var data:JplayerStatus;
54		public var msg:String = "";
55
56		public function JplayerEvent(type:String, data:JplayerStatus, msg:String = "", bubbles:Boolean = false, cancelable:Boolean = false) {
57			super(type, bubbles, cancelable);
58			this.data = data;
59			this.msg = msg;
60		}
61		public override function clone():Event {
62			return new JplayerEvent(type, data, msg, bubbles, cancelable);
63		}
64		public override function toString():String {
65			return formatToString("JplayerEvent", "type", "bubbles", "cancelable", "eventPhase", "data", "msg");
66		}
67	}
68}