dcsimg
A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Confetti

  1. #1
    Member
    Join Date
    Jun 2002
    Posts
    32

    Confetti

    Any suggestion on how do confetti? As in a wedding.

    I searched the board and it looks like others have also asked but no responses.

    thanks
    arlie

  2. #2
    Senior Member
    Join Date
    Apr 2002
    Location
    Saginaw, MI
    Posts
    185
    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...
    Attached Files Attached Files
    I am determined to make better mistakes tomorrow.

  3. #3
    Member
    Join Date
    Jun 2002
    Posts
    32

    Thanks

    Sorry for not getting back sooner but I had a family emergency.

    Great solution. I had tried several different approaches but yours is the best.

    arlie

  4. #4
    Junior Member
    Join Date
    Feb 2011
    Posts
    4

    How to do the same but without random numbers

    Hi,

    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.

    Any ideas would be greatly appreciated.

    Leao

  5. #5
    Moderator whispers's Avatar
    Join Date
    Mar 2001
    Location
    CFA2h (respect the HEX)
    Posts
    12,755
    It doesnt even make sense that Google wouldnt take a flash movie that genrates random numbers INTERNALLY...

  6. #6
    Junior Member
    Join Date
    Feb 2011
    Posts
    4
    Quote Originally Posted by whispers View Post
    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.

    Quote Originally Posted by Google Adwords Help
    Random numbers: Your ad may not include code that generates or uses random numbers.
    Any other ideas would be brilliant!!!

    Thanks,

    Leao

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center