A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Snowflakes appearing over my content - help!

  1. #1

    Snowflakes appearing over my content - help!

    Hi all,
    I have the following action script on the first frame of my movie:
    dup = Math.random()*5;
    for (dup=0; dup<20; dup++) {
    duplicateMovieClip(this.snowbit, "snowbit"+dup, dup);
    }


    and this on my snowflake:
    onClipEvent (load) {
    this._x=0 + Math.random()*800;
    this._y=-50 + Math.random()*700;
    this._alpha=Math.random()*100;
    var size;
    size=Math.random()*100;
    if (size>=60 && size<=200) {
    this._xscale=size;
    this._yscale=size;
    }
    else {
    this._xscale=120;
    this._yscale=120;
    }
    }

    onClipEvent (enterFrame) {
    pos = pos + (Math.random()*.1) ;
    this._x = this._x + Math.sin(pos) ;
    this._y = this._y + 1 + Math.random()*3;
    if (this._y>=700) {
    this._y = this._y - 800 + Math.random()*100;
    this._x = 0 + Math.random()*800;
    }
    }

    The snow is coming down fine, but it's appearing over all my other images on the page. I did move it below all the artwork on the timeline, but the snow is floating over everything. Any ideas what I might be missing?

    thanks!
    Butch

  2. #2
    Senior Member
    Join Date
    Apr 2002
    Posts
    2,849
    In this line:

    Code:
    duplicateMovieClip(this.snowbit, "snowbit"+dup, dup);
    That last "dup" stands for the depth of the snowflake, which ends up putting it above everything else. There are a couple of ways to fix this that should work.

    One would be to move all the snowflake stuff into a movie clip, and make sure that clip is below the right elements. I THINK that should work.

    Another way would be to use code to place the other elements above the snowflakes. This would only work on elements that have instance names (such as text or movie clips), and may screw things up if those elements are animated. But it would be something like:

    Code:
    myClip.swapDepths(100);

  3. #3
    Moving all the snowflake stuff into a mc worked. thanks much.

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