Skip to content

Instantly share code, notes, and snippets.

@bulkan
Created May 2, 2013 06:56
Show Gist options
  • Save bulkan/5500571 to your computer and use it in GitHub Desktop.
Save bulkan/5500571 to your computer and use it in GitHub Desktop.
goog.provide('events_tutorial.ColoredSprite');
goog.require('lime.Sprite');
goog.require('lime.animation.ColorTo');
goog.require('events_tutorial.Events');
events_tutorial.ColoredSprite = function(width, height) {
goog.base(this);
this.setSize(width, height).
setFill(100, 100, 100);
};
goog.inherits(events_tutorial.ColoredSprite, lime.Sprite);
events_tutorial.ColoredSprite.prototype.changeColor = function() {
var c = Math.floor(Math.random() * 256);
if (c > 128 ) {
events_tutorial.Events.dispatchEvent(
new events_tutorial.Events.ChangeColorEvent()
);
}
this.runAction(new lime.animation.ColorTo(c, c, c));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment