3 Replies Latest reply on Oct 6, 2006 12:32 PM by

    Modify AS to remove cursor interaction.

    Level 7
      I downloaded an fla from flashtriangleDOTcom, (which is now for sale and
      unreachable). Its a horizontal starfield moving from left to right. When
      one moves their cursor over the swf the stars alow down/speed up. I would
      like to remove this interactivity. I scoured the code to try to figure out
      which pieces controlled this but up to now have been unsuccessful. The code
      is simple and pasted below. Please take a look and see if you can help me
      modify it.

      //This is all the code in the whole fla

      numstars = 90;
      speed = 6;

      star_field = new Array (numstars);
      //x is x axis, y is y axis, z is speed of star

      function star(x,y,speed)
      {

      this.x = x;
      this.y = y;
      this.speed = speed;

      }

      for (i=0;i<numstars;i++)
      {

      star_field = new star(random(730),random(200),random(speed)+1);
      duplicateMovieClip ("star", "star_" add i, i+10);

      }

      function movestars()
      {
      for (i=0;i<numstars;i++)
      {

      star_field
      .x+= star_field .speed;

      if (star_field
      .x>730) { star_field .x = 0; }

      setProperty ("star_" add i , _x , star_field
      .x )
      setProperty ("star_" add i , _y , star_field .y )
      setProperty ("star_" add i , _alpha , star_field
      .speed*40 )

      }
      }

      setInterval(movestars,7);

      //End

      Thanks in advance for any help, and I'd like to thank the code author (from
      flashtriangle) for posting it.


        • 1. Re: Modify AS to remove cursor interaction.
          There is more to the code check the star movieclip in the library to see if it has code attached to it.
          • 2. Re: Modify AS to remove cursor interaction.
            Level 7
            I checked the star movie clip instance and there is no code attached to it.
            I am starting to wonder if the cursor movement over the swf isn't
            interactivity but rather causing the swf to stutter. I have seen animated
            starfields that stayed steady during rollover but can't seem to locate any
            now.

            Thanks for the reply. Let me know if you think of anything else. Does
            anybody know of any good horizontal, left to right starfield tutorials out
            there?

            "poisoniver" <webforumsuser@macromedia.com> wrote in message
            news:eg67e0$eev$1@forums.macromedia.com...
            > There is more to the code check the star movieclip in the library to see
            > if it has code attached to it.


            • 3. Re: Modify AS to remove cursor interaction.
              Ok sorry I couldn't be more help the reason I was saying there should be more code without even really debugging the code you posted was I was looking for an _xmouse or _ymouse call.