src/shims/moxie/js/moxie-swf.js
function(type) {
				var uid, list, args, tmpEvt, evt = {}, result = true, undef;
				
				if (Basic.typeOf(type) !== 'string') {
					// we can't use original object directly (because of Silverlight)
					tmpEvt = type;

					if (Basic.typeOf(tmpEvt.type) === 'string') {
						type = tmpEvt.type;

						if (tmpEvt.total !== undef && tmpEvt.loaded !== undef) { // progress event
							evt.total = tmpEvt.total;
							evt.loaded = tmpEvt.loaded;
						}
						evt.async = tmpEvt.async || false;
					} else {
						throw new x.EventException(x.EventException.UNSPECIFIED_EVENT_TYPE_ERR);
					}
				}
				
				// check if event is meant to be dispatched on an object having specific uid
				if (type.indexOf('::') !== -1) {
					(function(arr) {
						uid = arr[0];
						type = arr[1];
					}(type.split('::')));
				} else {
					uid = this.uid;
				}
				
				type = type.toLowerCase();
								
				list = eventpool[uid] && eventpool[uid][type];

				if (list) {
					// sort event list by prority
					list.sort(function(a, b) { return b.priority - a.priority; });
					
					args = [].slice.call(arguments);
					
					// first argument will be pseudo-event object
					args.shift();
					evt.type = type;
					args.unshift(evt);

					// Dispatch event to all listeners
					var queue = [];
					Basic.each(list, function(handler) {
						// explicitly set the target, otherwise events fired from shims do not get it
						args[0].target = handler.scope;
						// if event is marked as async, detach the handler
						if (evt.async) {
							queue.push(function(cb) {
								setTimeout(function() {
									cb(handler.fn.apply(handler.scope, args) === false);
								}, 1);
							});
						} else {
							queue.push(function(cb) {
								cb(handler.fn.apply(handler.scope, args) === false); // if handler returns false stop propagation
							});
						}
					});
					if (queue.length) {
						Basic.inSeries(queue, function(err) {
							result = !err;
						});
					}
				}
				return result;
			}
function(type) {
				var uid, list, args, tmpEvt, evt = {}, result = true, undef;
				
				if (Basic.typeOf(type) !== 'string') {
					// we can't use original object directly (because of Silverlight)
					tmpEvt = type;

					if (Basic.typeOf(tmpEvt.type) === 'string') {
						type = tmpEvt.type;

						if (tmpEvt.total !== undef && tmpEvt.loaded !== undef) { // progress event
							evt.total = tmpEvt.total;
							evt.loaded = tmpEvt.loaded;
						}
						evt.async = tmpEvt.async || false;
					} else {
						throw new x.EventException(x.EventException.UNSPECIFIED_EVENT_TYPE_ERR);
					}
				}
				
				// check if event is meant to be dispatched on an object having specific uid
				if (type.indexOf('::') !== -1) {
					(function(arr) {
						uid = arr[0];
						type = arr[1];
					}(type.split('::')));
				} else {
					uid = this.uid;
				}
				
				type = type.toLowerCase();
								
				list = eventpool[uid] && eventpool[uid][type];

				if (list) {
					// sort event list by prority
					list.sort(function(a, b) { return b.priority - a.priority; });
					
					args = [].slice.call(arguments);
					
					// first argument will be pseudo-event object
					args.shift();
					evt.type = type;
					args.unshift(evt);

					// Dispatch event to all listeners
					var queue = [];
					Basic.each(list, function(handler) {
						// explicitly set the target, otherwise events fired from shims do not get it
						args[0].target = handler.scope;
						// if event is marked as async, detach the handler
						if (evt.async) {
							queue.push(function(cb) {
								setTimeout(function() {
									cb(handler.fn.apply(handler.scope, args) === false);
								}, 1);
							});
						} else {
							queue.push(function(cb) {
								cb(handler.fn.apply(handler.scope, args) === false); // if handler returns false stop propagation
							});
						}
					});
					if (queue.length) {
						Basic.inSeries(queue, function(err) {
							result = !err;
						});
					}
				}
				return result;
			}
function ( type ) { var uid , list , args , tmpEvt , evt = { } , result = true , undef ; if ( Basic . typeOf ( type ) !== 'string' ) { // we can't use original object directly (because of Silverlight) tmpEvt = type ; if ( Basic . typeOf ( tmpEvt . type ) === 'string' ) { type = tmpEvt . type ; if ( tmpEvt . total !== undef && tmpEvt . loaded !== undef ) { // progress event evt . total = tmpEvt . total ; evt . loaded = tmpEvt . loaded ; } evt . async = tmpEvt . async || false ; } else { throw new x . EventException ( x . EventException . UNSPECIFIED_EVENT_TYPE_ERR ) ; } } // check if event is meant to be dispatched on an object having specific uid if ( type . indexOf ( '::' ) !== - 1 ) { ( function ( arr ) { uid = arr [ 0 ] ; type = arr [ 1 ] ; } ( type . split ( '::' ) ) ) ; } else { uid = this . uid ; } type = type . toLowerCase ( ) ; list = eventpool [ uid ] && eventpool [ uid ] [ type ] ; if ( list ) { // sort event list by prority list . sort ( function ( a , b ) { return b . priority - a . priority ; } ) ; args = [ ] . slice . call ( arguments ) ; // first argument will be pseudo-event object args . shift ( ) ; evt . type = type ; args . unshift ( evt ) ; // Dispatch event to all listeners var queue = [ ] ; Basic . each ( list , function ( handler ) { // explicitly set the target, otherwise events fired from shims do not get it args [ 0 ] . target = handler . scope ; // if event is marked as async, detach the handler if ( evt . async ) { queue . push ( function ( cb ) { setTimeout ( function ( ) { cb ( handler . fn . apply ( handler . scope , args ) === false ) ; } , 1 ) ; } ) ; } else { queue . push ( function ( cb ) { cb ( handler . fn . apply ( handler . scope , args ) === false ) ; // if handler returns false stop propagation } ) ; } } ) ; if ( queue . length ) { Basic . inSeries ( queue , function ( err ) { result = ! err ; } ) ; } } return result ; }
Dispatch the event

@method dispatchEvent
@param {String/Object} Type of event or event object to dispatch
@param {Mixed} [...] Variable number of arguments to be passed to a handlers
@return {Boolean} true by default and false if any handler returned false
Dispatch the event