# Flash 5 : random colours with transition fade

**URL:** https://forum.kirupa.com/t/flash-5-random-colours-with-transition-fade/14501
**Category:** flash
**Created:** [February 27, 2003, 2:02am UTC](https://forum.kirupa.com/t/flash-5-random-colours-with-transition-fade/14501 "2003-02-27T02:02:30Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Ultras](https://avatars.discourse-cdn.com/v4/letter/u/9fc348/32.png) [@Ultras](https://forum.kirupa.com/u/Ultras)
#### Post date: [February 27, 2003, 2:02am UTC](https://forum.kirupa.com/t/flash-5-random-colours-with-transition-fade/14501/1 "2003-02-27T02:02:30Z")

</div>

ok im trying to create a clip of a dot that fades randomly between four pre defined colours whilst also randomly varying in the size range 0 - 100%. i am trying to create a smooth size tween also.  
this is my attempt:

size = random(100);  
setProperty (“purple”, \_xscale, size);  
setProperty (“purple”, \_yscale, size);  
myArray = [“0x399FB6”, “0xCBC5D7”, “0x5A3084”, “0xffffff”, “0x399FB6”];  
myArray[0] = 0x399FB6;  
myArray[1] = 0xCBC5D7;  
myArray[2] = 0x5A3084;  
myArray[3] = 0xffffff;  
myArray[4] = 0x399FB6;  
col = random(4);  
myColor = new Color(purple);  
purple.\_alpha=100;  
myColor.setRGB(myArray[col]);

where purple is the next key frame instance of the dot with a tween between the two (ie purple and the one with the above script).

this script randomly changes both the size and colour in the desired way but for nothing can i get the dots to fade / change smoothly :hair:

some 1 help with this and i will perform anything you ask of me 😛 and be forever indebted…

here is the fla

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [February 27, 2003, 11:27am UTC](https://forum.kirupa.com/t/flash-5-random-colours-with-transition-fade/14501/2 "2003-02-27T11:27:33Z")

</div>

Concerning the size transition, it could be something like this:

```auto
onClipEvent(load){
  targSize=100;
}
onClipEvent(enterFrame){
  var diff=_xscale-targSize;
  if (Math.abs(diff)<1) targSize=random(100);
  _xscale=_yscale+=diff/7;
}

```

Look at the easing tutorial to ee what I mean.

And concerning the color transform, it’s a lot harder to do. Look up the setTransform method and see what you can do with it.

pom 🙂

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [February 27, 2003, 2:58pm UTC](https://forum.kirupa.com/t/flash-5-random-colours-with-transition-fade/14501/3 "2003-02-27T14:58:05Z")

</div>

ok thanks i will … was thinking in bed its gonna have to be some iterative thing… :run:
