With Javascript/Web project this code will work:
/** Rotates a cc.Node object to a certain angle by modifying it's
* rotation attribute.
* The direction will be decided by the shortest angle.
* @class
* @extends cc.ActionInterval
*/
rs.SizeTo = cc.ActionInterval.extend({
_dstValue:0,
_startValue:0,
_diffValue:0,
/**
* @param {Number} duration
* @param {Number} deltaAngleX
* @param {Number} deltaAngleY
* @return {Boolean}
*/
initWithDuration:function (duration, value) {
if (cc.ActionInterval.prototype.initWithDuration.call(this, duration)) {
this._dstValue = value || 0;
return true;
}
return false;
},
/**
* @param {cc.Node} target
*/
startWithTarget:function (target) {
cc.ActionInterval.prototype.startWithTarget.call(this, target);
this._startValue = target.getContentSize();
this._diffValue = this._dstValue - this._startValue.width;
},
/**
* RotateTo reverse not implemented
*/
reverse:function () {
cc.Assert(0, "RotateTo reverse not implemented");
},
/**
* @param {Number} time time in seconds
*/
update:function (time) {
if (this._target){
this._target.setContentSize(new cc.Size(this._startValue.width + (this._diffValue * time), this._startValue.height));
}
}
});
How can one extends the action interval class for Cocos2d-x Android/JS project?
Because in android Debug error gives:
DEBUG/cocos2d-x debug info(24129): JS: assets/progressBar.js:127:TypeError: cc.ActionInterval.extend is not a function