3 Replies Latest reply on Dec 13, 2006 7:46 AM by kglad

    Make Actionscript Snow effect happen only inside mask

    ChuckRWD Level 1
      Esteemed Flash Gurus-
      I have an effect to simulate snow that is written entirely with actionscript, no big deal, however where I am having a problem is that I have a complex shape where I want the snow to appear and need it only to snow inside a mask layer. I have tried placing the layer with the actual snow movie clip inside a mask layer, but that is not working. Like I said, the background has many curves and I cannot just simply state a maximum width and height, I need it to appear inside this mask without having to put in million movie clips myself inside a mask. Here is the code for the snow:

      for (k=0; k<50; k++) {
      duplicateMovieClip(_root.snow, "snow"+k, k);
      }

      onClipEvent (load) {
      movieWidth = 787;
      movieHeight = 239;
      i = 1+Math.random()*2;
      k = -Math.PI+Math.random()*Math.PI;
      this._xscale = this._yscale=50+Math.random()*100;
      this._alpha = 75+Math.random()*100;
      this._x = -10+Math.random()*movieWidth;
      this._y = -10+Math.random()*movieHeight;
      }
      onClipEvent (enterFrame) {
      rad += (k/180)*Math.PI;
      this._x -= Math.cos(rad);
      this._y += i;
      if (this._y>=movieHeight) {
      this._y = -5;
      }
      if ((this._x>=movieWidth) || (this._x<=0)) {
      this._x = -10+Math.random()*movieWidth;
      this._y = -5;
      }
      }

      Please advise...need help quick on this one!
      Cheers-
      Chuck