CWinText.js 1.1 KB

1234567891011121314151617181920212223242526272829
  1. function CWinText(iX,iY,szText,szColor){
  2. var _oContainer;
  3. this._init = function(iX,iY,szText,szColor){
  4. _oContainer = new createjs.Container();
  5. _oContainer.x = iX;
  6. _oContainer.y = iY;
  7. s_oStage.addChild(_oContainer);
  8. var oText = new createjs.Text("+"+szText,"70px "+FONT_GAME, szColor);
  9. oText.textAlign = "center";
  10. oText.textBaseline = "middle";
  11. oText.shadow = new createjs.Shadow("#000000", 2, 2, 3);
  12. _oContainer.addChild(oText);
  13. var iRandTime = Math.floor(Math.random()*1500) + 500;
  14. var oParent = this;
  15. createjs.Tween.get(oText).to({y:oText.y - 100}, iRandTime,createjs.Ease.sineOut).call(function(){
  16. createjs.Tween.get(oText).to({alpha:0}, 500).call(function(){oParent.unload();});
  17. });
  18. };
  19. this.unload = function(){
  20. s_oStage.removeChild(_oContainer);
  21. };
  22. this._init(iX,iY,szText,szColor);
  23. }