home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Nave / AitchuTheAbduction.swf / scripts / frame_18 / DoAction.as
Encoding:
Text File  |  2005-11-10  |  2.4 KB  |  101 lines

  1. ScrollBar = function()
  2. {
  3.    this._x = 0;
  4.    this._y = 0;
  5.    this.largeur = 100;
  6.    this.hauteur = 20;
  7.    this.donneeMax = 100;
  8. };
  9. ScrollBar.prototype = new MovieClip();
  10. ScrollBar.prototype.onEnterFrame = function()
  11. {
  12.    if(this.donnee > -1)
  13.    {
  14.       this.afficheBar();
  15.    }
  16. };
  17. ScrollBar.prototype.traceBar = function()
  18. {
  19.    this.beginFill(this.colorBar,80);
  20.    this.moveTo(0,0);
  21.    this.lineTo(this.donnee * this.largeur / this.donneeMax,0);
  22.    this.lineTo(this.donnee * this.largeur / this.donneeMax,this.hauteur);
  23.    this.lineTo(0,this.hauteur);
  24.    this.lineTo(0,0);
  25.    this.endFill();
  26. };
  27. ScrollBar.prototype.traceContour = function()
  28. {
  29.    this.lineStyle(1,this.colorline,50);
  30.    this.moveTo(0,0);
  31.    this.lineTo(this.largeur,0);
  32.    this.lineTo(this.largeur,this.hauteur);
  33.    this.lineTo(0,this.hauteur);
  34.    this.lineTo(0,0);
  35. };
  36. ScrollBar.prototype.afficheBar = function()
  37. {
  38.    this.clear();
  39.    this.traceBar();
  40.    this.traceContour();
  41. };
  42. ScrollBar.prototype.init = function(x, y, larg, haut, col, colLine)
  43. {
  44.    this._x = x;
  45.    this._y = y;
  46.    this.largeur = larg;
  47.    this.hauteur = haut;
  48.    this.colorBar = col;
  49.    this.colorline = colLine;
  50. };
  51. PowerScrollBar = function()
  52. {
  53.    super();
  54. };
  55. PowerScrollBar.prototype = new ScrollBar();
  56. Object.registerClass("PowerBarClip",PowerScrollBar);
  57. PowerScrollBar.prototype.onEnterFrame = function()
  58. {
  59.    super.onEnterFrame();
  60.    this.donnee = this._parent.vesso.power;
  61. };
  62. LifeScrollBar = function()
  63. {
  64.    super();
  65.    this.donneeMax = 1000;
  66. };
  67. LifeScrollBar.prototype = new ScrollBar();
  68. Object.registerClass("LifeBarClip",LifeScrollBar);
  69. LifeScrollBar.prototype.onEnterFrame = function()
  70. {
  71.    super.onEnterFrame();
  72.    this.donnee = this._parent.vesso.vie;
  73. };
  74. LifeBossScrollBar = function()
  75. {
  76.    super();
  77.    this.donneeMax = 5000;
  78. };
  79. LifeBossScrollBar.prototype = new ScrollBar();
  80. Object.registerClass("LifeBossBarClip",LifeBossScrollBar);
  81. LifeBossScrollBar.prototype.onEnterFrame = function()
  82. {
  83.    super.onEnterFrame();
  84.    this.donnee = this._parent.vie;
  85. };
  86. ScrollBar.prototype.traceContour = function()
  87. {
  88.    this.lineStyle(2,this.colorline,50);
  89.    var i = 0;
  90.    while(i <= this.largeur)
  91.    {
  92.       this.moveTo(i,0);
  93.       this.lineTo(i,this.hauteur);
  94.       i += this.largeur / 10;
  95.    }
  96.    this.moveTo(0,0);
  97.    this.lineTo(this.largeur,0);
  98.    this.moveTo(this.largeur,this.hauteur);
  99.    this.lineTo(0,this.hauteur);
  100. };
  101.