A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: random RRGGBB.?

  1. #1
    Where have I been ??
    Join Date
    Oct 2001
    Posts
    305
    What I have is a scrolling type background. I have balls that move from the left side off the right hand edge. After the ball passes completly off the right edge, I reassign its _x value so it is back on the left hand side. What I am wondering, is there a way so that everytime I reassign the _x to the left hand side, can I also assign a Random RRGGBB value?? And if so, is there a way that I can limit the value. Kind of how you can limit the random in between two numbers using random(50)+100. Can I set it where the value of the colors will be random but only between like... #005555 and #66AAAA ???

    Any help is greatly appreciated.

  2. #2
    Senior Kid
    Join Date
    Jan 2002
    Location
    I am right behind ya
    Posts
    274
    use
    color_object = new color(MC);
    color_object.setRGB(random(256)<<16|random(256)<<8 |random(256));

    of course u can use variables instead of those random(xxx) to implement more complicated random events

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