dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: RANDOM COLOURS

  1. #1
    Senior Member
    Join Date
    Aug 2000
    Posts
    473

    Smile

    Im placing 20 instances of a movie clip on screen but i want them all to be randomly diffrent colours.....but is there a way i can decide the colurs that they can only be ????

  2. #2
    Senior Member
    Join Date
    Feb 2002
    Location
    Lebanon
    Posts
    573
    HI..
    I suggest you put the colors that you want to show only in an array, and so assign a random color by choosing a random item from that array.. something like this:
    Code:
    colors=[0xff00ff,0xfd4555,0x556677,0xffffff]
    c = new Color(myMC);
    c.setRGB(colors[random(colors.length)]);
    that's all

    tell us in case you needed some other thing.
    regards,
    - m.Saleh

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