A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: mc property to change colour?

  1. #1
    Senior Member
    Join Date
    Apr 2003
    Posts
    103

    mc property to change colour?

    is there a mc property that changes the tint/colour of a mc like the _alpha tag does for alpha? would be sooo handy...

  2. #2
    Member
    Join Date
    Apr 2004
    Posts
    82
    code:
    Color.prototype.setTint = function (r, g, b, amount)
    {
    var trans = new Object();
    trans.ra = trans.ga = trans.ba = 100 - amount;
    var ratio = amount / 100;
    trans.rb = r * ratio;
    trans.gb = g * ratio;
    trans.bb = b * ratio;
    this.setTransform(trans);
    }

    var myColor = new Color( miniboss );
    myColor.setTint(255,0,0, 50 - miniboss.health / 2 );

    That's what I have in my game. The 255 is for a red tint, and the little math in there is the amount. As you can see mine depends on how much health the boss has left.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center