| home | about | time | appearance | space | other | tips & tricks |
Bulls EyeThis is a simple effect and it involves a couple of instances of the same Movie Clip. Open Flash, draw a circle (don't forget to hold Shift when you use the Oval Tool) and convert it into a movie Clip. It doesn't matter what the color is. Click the Movie Clip and add:
onClipEvent( enterFrame ) {
r = random(256);
g = random(256);
b = random(256);
colourobj = new Color(this)
colourobj.setRGB( r<<16|g<<8|b )
}
The colors are hexadecimal numbers of 6 digits (0..F). A=10 B=11 C=12 D=13 E=14 F=15 First two digits are coding the amount of Red, the two in the middle are coding the amount of Green and the last two, the amount of Blue. Two hexadecimal digits compose a number between 00 and FF( or between 0 and 255 as a decimal number). So in order to create a random color we need to create random values for the three parameters. That's what we did in the three variables "r", "g", "b", because random(256) means an integer number between the desired limits. colourobj=new Color(this); creates a Color object for the circle Movie Clip (this points to the Object we are working on) colourobj.setRGB(r<<16|g<<8|b); sets the randomly obtained color to the Color object (the color is obtained by transforming from the decimal to the hexadecimal; if you are a novice or not familiarized with hexadecimal techniques of manipulating numbers, take the expression as it is). But here is the explication: "r", "g", "b" are hexadecimal numbers of 2 digits each r=RR=rrrrrrrr (8 digits in decimal) R=[0..F] r=[0..1] g=GG=gggggggg same as "r" b=BB=bbbbbbbb same as "r" r<<16=rrrrrrrr0000000000000000 g<<8=gggggggg00000000 the order is (r<<16)|(g<<8)|b=rrrrrrrr0000000000000000 | gggggggg00000000 | bbbbbbbb= =rrrrrrrrggggggggbbbbbbbb=RRGGBB That's all folks! |
| Copyright © 2010 WebArticles.org. All rights reserved. Privacy Policy. |
| FlashRandomEffects.WebArticles.Org is not affiliated with Adobe Systems Incorporated, USA. Adobe Flash is a registered trademark of Adobe Systems, Inc in the United States of America and/or other countries. The purpose of this website is to provide information for mastering Adobe Flash and creating Flash effects. |