i got it! first name layer 1 "confetti" and create a new layer and name it "controL". make a small 7*7 red square on the confetti layer, convert it 2 a movie clip and name it "confetti1". put this code of frame1 of the "control" layer:
numConfetti = 100;
for (i=2; i<=numConfetti; i++) {
confetti1.duplicateMovieClip("confetti"+i, i+100);
}
then add these actions to the "confetti1" clip:
onClipEvent (load) {
function reset() {
//generate the random color
R = random(256);
G = random(256);
B = random(256);
colorHexString = R.toString(16)+G.toString(16)+B.toString(16);
colorHex = parseInt(colorHexString, 16);
hairColor = new Color(this);
hairColor.setRGB(colorHex);
//generates random movemtn onscreen
xSpeed = random(3)+1;
ySpeed = (Math.random()+1)*random(5)+1;
if (ySpeed == 1) {
ySpeed = (Math.random()+1)*random(5)+1;
}
direction = random(2)+1;
//randomly places confetti at the top of the screen
position = random(550)+1;
_x = position;
_y = 0;
}
reset();
}
onClipEvent (enterFrame) {
//makes the confetti fall
_y += ySpeed;
directionChange = random(10)+1;
if (directionChange == 1) {
direction = random(2)+1;
xSpeed = random(3)+1;
}
if (direction == 1) {
_x += xSpeed;
}
if (direction == 2) {
_x -= xSpeed;
}
if (_y>400) {
reset();
}
}
hope that helps u, o and i attatched the fla so u can c it working. if it doesnt work for u that is...
This code is brilliant and I tried to use it as part of a Google ad banner but the problem is that the code contains random numbers and Google ads won't except Flash ads that employ random numbers.
Is there any way around this?
I have even tried animating each of the pieces of confetti manually but this pushes up the file size to way over 50K which is the size limite for a Google Flash ad.
It doesnt even make sense that Google wouldnt take a flash movie that genrates random numbers INTERNALLY...
Adwords definitely doesn't accept Flash movies with random numbers internally or externally. I tried to submit one and it said Encountered flash error - ad cannot have a random number.See this link on Google Adwords Help page.
Originally Posted by Google Adwords Help
Random numbers: Your ad may not include code that generates or uses random numbers.