simplify slider and videoplayer event register

This commit is contained in:
zilongshanren
2016-10-19 14:37:39 +08:00
parent 0bd5a8e2a3
commit 0c5b95d5b6
2 changed files with 10 additions and 2 deletions
+3 -2
View File
@@ -182,11 +182,12 @@ var Slider = cc.Class({
_handleSliderLogic: function (touch) {
this._updateProgress(touch);
this._emitSldeEvent();
this._emitSlideEvent();
},
_emitSldeEvent: function () {
_emitSlideEvent: function () {
cc.Component.EventHandler.emitEvents(this.slideEvents, this);
this.node.emit('slide', this);
},
_updateProgress: function (touch) {
+7
View File
@@ -265,30 +265,37 @@ var VideoPlayer = cc.Class({
onReadyToPlay: function () {
cc.Component.EventHandler.emitEvents(this.videoPlayerEvent, this, EventType.READY_TO_PLAY);
this.node.emit('ready-to-play', this);
},
onMetaLoaded: function () {
cc.Component.EventHandler.emitEvents(this.videoPlayerEvent, this, EventType.META_LOADED);
this.node.emit('meta-loaded', this);
},
onClicked: function () {
cc.Component.EventHandler.emitEvents(this.videoPlayerEvent, this, EventType.CLICKED);
this.node.emit('clicked', this);
},
onPlaying: function(){
cc.Component.EventHandler.emitEvents(this.videoPlayerEvent, this, EventType.PLAYING);
this.node.emit('playing', this);
},
onPasued: function() {
cc.Component.EventHandler.emitEvents(this.videoPlayerEvent, this, EventType.PAUSED);
this.node.emit('paused', this);
},
onStopped: function() {
cc.Component.EventHandler.emitEvents(this.videoPlayerEvent, this, EventType.STOPPED);
this.node.emit('stopped', this);
},
onCompleted: function() {
cc.Component.EventHandler.emitEvents(this.videoPlayerEvent, this, EventType.COMPLETED);
this.node.emit('completed', this);
},
/**