Help on random color thing

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.

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 :stuck_out_tongue:

pom :asian:

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

(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. :slight_smile: )

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:

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

Rate the thread, guys!!

pom :asian:

rateing threads is so overated… hehehe :slight_smile:

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.

*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. :slight_smile: ) **
:stuck_out_tongue:

_trunk.gotoAndPlay(5);

I like that.

pom :stuck_out_tongue:

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

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

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

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… :slight_smile: have fun :slight_smile:

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 :slight_smile:

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… :slight_smile:

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:

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. :slight_smile:

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.

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…

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

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.