Jump to content
Search Community

tint plugin-random colors

ekessler test
Moderator Tag

Recommended Posts

Sure.

 

var randomColor:uint = 0xFFFFFF * Math.random();
TweenLite.to(mc, 1, {tint:randomColor});

 

You could also use an array if you want.

var colors:Array = [0xFF0000, 0x00FF00, 0x0000FF];
var randomColor:uint = colors[ int(Math.random() * colors.length) ];
TweenLite.to(mc, 1, {tint:randomColor});

Link to comment
Share on other sites

Your function worked fine for me, although I'd cast the value in the return like this:

 

function colorRandom():uint {
   return uint(0xFFFFFF * Math.random());
}

 

Did you forget to activate the TintPlugin for use in TweenLite maybe? Are you saying that when you call colorRandom() you always get "0" back?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...