# Help on random color thing

**URL:** https://forum.kirupa.com/t/help-on-random-color-thing/5458
**Category:** Uncategorized
**Created:** [September 12, 2002, 12:55am UTC](https://forum.kirupa.com/t/help-on-random-color-thing/5458 "2002-09-12T00:55:50Z")
**Posts on this page:** 20
**Page:** 2

<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: [September 13, 2002, 2:23am UTC](https://forum.kirupa.com/t/help-on-random-color-thing/5458/21 "2002-09-13T02:23:17Z")

</div>

Depth is the just that. The depth your movie is loaded. Your movie default loads at depth 0.

Think of depth as using the layers, you create a new layer and if it is higher than the other levels, you can see it on top over everything under it. This is because it is on a higher depth level.

---

<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: [September 13, 2002, 9:46am UTC](https://forum.kirupa.com/t/help-on-random-color-thing/5458/22 "2002-09-13T09:46:49Z")

</div>

Actually, Lost, that’s not exactly what I meant, and it’s my fault because I didn’t express myself correctly (and I think you’re confusing levels and depths, but that’s another story). I should have said something even more confusing like ‘at the same level in the tree’.

Basically, \_root is the root of your tree. Any clip that’s going to be on the scene is a branch. Then, each branch can have movie clips in it, that is to say little branchs and so on and so forth.

So let’s take a simple case of 2 clips in the \_root, _clip1_ and _clip2_. You want to access clip2 from clip1. But they are not directly connected, they are connected through the \_root, which is the branch that is 1 level up in the tree. To go one level up, you use \_parent, which (in this case) gets us on the \_root.

Finally, \_parent.clip2 gets us on that other branch we’re trying to reach.

Wow, I impressed myself on that one 😛

pom :asian:

---

<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: [September 13, 2002, 9:48am UTC](https://forum.kirupa.com/t/help-on-random-color-thing/5458/23 "2002-09-13T09:48:28Z")

</div>

We’re going a bit astray, but this should be in the BOKirupa, don’t you think?

---

<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: [September 13, 2002, 9:56am UTC](https://forum.kirupa.com/t/help-on-random-color-thing/5458/24 "2002-09-13T09:56:16Z")

</div>

(technicaly speaking though the \_root is more of the trunk of the tree than the roots… but that’s just nit picking… plus I don’t think that \_trunk would have gone over as well for some reason. 🙂 )

---

<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: [September 13, 2002, 11:25am UTC](https://forum.kirupa.com/t/help-on-random-color-thing/5458/25 "2002-09-13T11:25:44Z")

</div>

hrmmm i’ve always used

> (Math.random() \* 255 \<\< 16 | Math.random() \* 255 \<\< 8 | Math.random() \* 255)

But yeah it probably works the same as Math.random()\*0x000000

:):pirate:

---

<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: [September 13, 2002, 1:19pm UTC](https://forum.kirupa.com/t/help-on-random-color-thing/5458/26 "2002-09-13T13:19:53Z")

</div>

Yeah, more or less the same. Except in your code you control independently the red, blue and green. But since it’s random… 😛

Rate the thread, guys!!

pom :asian:

---

<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: [September 13, 2002, 1:44pm UTC](https://forum.kirupa.com/t/help-on-random-color-thing/5458/27 "2002-09-13T13:44:20Z")

</div>

rateing threads is so overated… hehehe 🙂

---

<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: [September 13, 2002, 3:25pm UTC](https://forum.kirupa.com/t/help-on-random-color-thing/5458/28 "2002-09-13T15:25:02Z")

</div>

Ok, I am late on the subject but…

Ilyas: You are right I got myself all mixed up there for a second. I have no clue what went on being it was only 10:30pm so it wasn’t like when I mix myself up at 3:00am. Hmm, odd, oh well, thank you for correcting me.

---

<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: [September 14, 2002, 5:42pm UTC](https://forum.kirupa.com/t/help-on-random-color-thing/5458/29 "2002-09-14T17:42:49Z")

</div>

> \*Originally posted by david \*  
> \*\*(technicaly speaking though the \_root is more of the trunk of the tree than the roots… but that’s just nit picking… plus I don’t think that \_trunk would have gone over as well for some reason. 🙂 ) \*\*  
> 😛

```auto
_trunk.gotoAndPlay(5);

```

I like that.

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: [September 14, 2002, 7:52pm UTC](https://forum.kirupa.com/t/help-on-random-color-thing/5458/30 "2002-09-14T19:52:04Z")

</div>

Haha, we should take that up with Macromedia. Maybe they will change it to \_trunk:P

---

<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: [September 14, 2002, 10:42pm UTC](https://forum.kirupa.com/t/help-on-random-color-thing/5458/31 "2002-09-14T22:42:04Z")

</div>

sorry i came in too late… but i have a question about the code ilyaslamasse posted.  
Could someone explain the Math.sin thing. I don’t get it!

:o

---

<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: [September 15, 2002, 5:11am UTC](https://forum.kirupa.com/t/help-on-random-color-thing/5458/32 "2002-09-15T05:11:31Z")

</div>

hehe well maybe it means that the “root” is the begining of everything…its the thing that holds it all together… 🙂

---

<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: [September 15, 2002, 5:14am UTC](https://forum.kirupa.com/t/help-on-random-color-thing/5458/33 "2002-09-15T05:14:49Z")

</div>

Math.sin is triganometry…its the sine thingy… it uses your angle to work out a posostion that a thing should be so like  
\_x = Math.sin(angle\*Math.PI/180)\*radius+centerX;

If you make something like that it should move up and from left to right… 🙂 have fun 🙂

---

<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: [September 15, 2002, 9:34am UTC](https://forum.kirupa.com/t/help-on-random-color-thing/5458/34 "2002-09-15T09:34:56Z")

</div>

Well, thanks for the explanation, although i’m afraid i will never be able to use such thing. At least conciously… i was never good when messing with triganometry.

Ummm, in fact i think i will never be good at coding because i have always been veeeeery bad at maths. God, triganomatry makes me shake and sweat! he, he, he…

Anyway, i’ll give it a try, just for fun. Thanks again 🙂

---

<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: [September 15, 2002, 11:24am UTC](https://forum.kirupa.com/t/help-on-random-color-thing/5458/35 "2002-09-15T11:24:23Z")

</div>

you dont have to be that great at maths to do things like this…im not really that great at maths…i just understand basic stuff…u should still be able to do programing even if your not a maths wiz… 🙂

---

<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: [September 15, 2002, 6:40pm UTC](https://forum.kirupa.com/t/help-on-random-color-thing/5458/36 "2002-09-15T18:40:49Z")

</div>

The big interesting thing about the sine function is that its values are located between -1 and 1. It goes up, and then down very smoothly. And most important: it’s cycling. Exactly what we want for our colours.

You can also check the plotter I did in the Open source section for a plot of the function.

pom :asian:

---

<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: [September 15, 2002, 7:11pm UTC](https://forum.kirupa.com/t/help-on-random-color-thing/5458/37 "2002-09-15T19:11:44Z")

</div>

and as for higher math… don’t you worry about it Lostandfund, I am one of the worst math students anywhere and even I’m getting into sines and cosines. The beuty of it is that you really only need to know what the functions do. Like a calculator… Flash does the hard part of calculating it for you. 🙂

Bear with it, and try to do small tutorials that take advantage of them. That is the way to learn how they work.

I remember doing a tutorial on a bouncing ball which used a sign wave to create the movement. It was so simple, and the first time I had a clue what sine did.

---

<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: [September 16, 2002, 5:54pm UTC](https://forum.kirupa.com/t/help-on-random-color-thing/5458/38 "2002-09-16T17:54:17Z")

</div>

Well, I’ll have to believe you, because this weekend i finally succeded in coding a function that worked! I couldn’t believe it. And what’s even funniest, i don’t even know how i did it… Human mind is a mistery, yes sir!

EDIT:ummm I wonder how to use this with alpha… I’ll give it a try…

---

<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: [September 18, 2002, 9:40pm UTC](https://forum.kirupa.com/t/help-on-random-color-thing/5458/39 "2002-09-18T21:40:38Z")

</div>

hey since depth was mentioned, and I am too busy to try it out… Flash always publishes from “Bottom Up”… if you swaped this for the other option “Top Down” would that make a depth of 1 the highest ans 2 lower etc?

Peace

---

<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: [September 18, 2002, 9:45pm UTC](https://forum.kirupa.com/t/help-on-random-color-thing/5458/40 "2002-09-18T21:45:11Z")

</div>

I don’t think that changes the order. It just changes the order that your movie loads. So it loads from top to bottom instead of bottom to top without changing the order.

[Previous page](https://forum.kirupa.com/t/help-on-random-color-thing/5458.md?page=1)

[Next page](https://forum.kirupa.com/t/help-on-random-color-thing/5458.md?page=3)
