3 Replies Latest reply on Mar 29, 2007 1:00 PM by kglad

    Works in Flash 6 player but not 8

    Level 7
      I am working with a sample .fla file that produces the snow fall affect. The
      issue is that it only works if my publish settings are set to Flash Player 6
      rather than 8. I need it get working with my published settings set to 8.
      Here is a link to the file and the actionscipt.

      http://www.deconcept.com click on the one labeled SNOW

      ACTIONSCRIPT:

      fscommand("allowscale", false);
      stop();
      // -------------
      stageWidth = 800;
      stageHeight = 200;
      this.createEmptyMovieClip("snowController", 0);
      // --- i added this mask for display on deconcept.com - you are free to
      comment it out and the snow will work fine, but don't forget to change the
      stage height and width anyway
      // --- create the mask to hide flakes that sway too far to the left or
      right
      this.createEmptyMovieClip("myMask", 9999999999);
      myMask.beginFill(0x000000, 100);
      myMask.moveTo(0,0);
      myMask.lineTo(stageWidth, 0);
      myMask.lineTo(stageWidth, stageHeight);
      myMask.lineTo(0, stageHeight);
      myMask.endFill();
      snowController.setMask(myMask);
      // -- end mask
      snowController.createFlake = function() {
      depth++;
      this.attachMovie("flake", "flake"+depth, depth);
      myFlake = this["flake"+depth];
      myFlake._x = Math.floor(Math.random()*stageWidth);
      myFlake._y = -5;
      myFlake._xscale = Math.round(Math.random()*34);
      myFlake._yscale = Math.round(Math.random()*34);
      // ------ set vars for movement
      myFlake.d = 1.7;
      myFlake.a = 7;
      myFlake.newX = myFlake._x;
      myFlake.newY = myFlake._y;
      myFlake.myXspeed = 0;
      myFlake.myYspeed = 0;
      myFlake.ySpeed = (myFlake._width + myFlake._height)/2;
      // -------------------------------------------
      myFlake.onEnterFrame = function () {
      if (!Math.floor(Math.random()*8)) {
      this.xSpeed = Math.round(Math.random()*10)-5;
      }
      this.newX += this.xSpeed;
      this.newY += this.ySpeed;
      if (this._y > stageHeight) { // this removes the clip once it reaches a
      certain point
      this.removeMovieClip();
      }

      this.myXspeed = ((this._x-this.newX)/this.a+this.myXspeed)/this.d; // this
      is just movement code to make is move smoother
      this.myYspeed = ((this._y-this.newY)/this.a+this.myYspeed)/this.d;
      this._x -= this.myXspeed;
      this._y -= this.myYspeed;
      }
      }
      // ----------------
      snowController.onEnterFrame = function () {
      if (!Math.floor(Math.random()*3)) {
      this.createFlake();
      }
      }