4 Replies Latest reply: Jul 7, 2006 12:14 PM by gold987987987 RSS

    Buggy Action Script

    gold987987987 Community Member
      Hey Everyone,
      I recently upgraded from MX 2004 to FLASH 8 and some things stopped working. I'm currently Publishing in Player 6 and AS 2. Can someone look over this AS and tell me if they see something that keeps this from working?
      Thanks,

      Here is some AS for a button that makes a page move around in a frame.

      on (rollOver) {
      gotoAndPlay("s1");
      }
      on (releaseOutside, rollOut) {
      gotoAndPlay("s2");
      }
      on (release) {
      if (_root.b<>4 and _root.m<>1) {
      _root.cont.gotoAndPlay("s1");
      _root.b = 4;
      _root.xkoord = -225;
      _root.ykoord = 395;
      _root.pages.pag4.t1 = "";
      _root.pages.pag4.t2 = "";
      _root.pages.pag4.t3 = "";
      _root.pages.pag4.t4 = "";
      }
      }


      Here the AS for the page that the button moves around:

      on(load) {
      accel = _root.accel;
      rate = _root.rate;
      }
      on (enterFrame) {
      y = y*accel+(_root.ykoord-_y)*rate;
      _y += y;
      x = x*accel+(_root.xkoord-_x)*rate;
      _x += x;
      if (Math.abs(_root.ykoord-_y)<1) {
      _y = _root.ykoord;
      }
      if (Math.abs(_root.xkoord-_x)<1) {
      _x = _root.xkoord;
      }
      }

      Do you see anything wrong? Why would this stop working???
      Thanks for you help.
        • 1. Re: Buggy Action Script
          Newsgroup_User Community Member
          use != instead of <>, use && instead of and
          --
          Jeckyl


          • 2. Re: Buggy Action Script
            gold987987987 Community Member
            We'll I think I changed what you said and it still doesn't work. Here is what I changed:
            on (rollOver) {
            gotoAndPlay("s1");
            }
            on (releaseOutside, rollOut) {
            gotoAndPlay("s2");
            }
            on (release) {
            if (_root.b!=4 && _root.m!=1) {
            _root.cont.gotoAndPlay("s1");
            _root.b = 4;
            _root.xkoord = -225;
            _root.ykoord = 395;
            _root.pages.pag4.t1 = "";
            _root.pages.pag4.t2 = "";
            _root.pages.pag4.t3 = "";
            _root.pages.pag4.t4 = "";
            }
            }

            Is that correct? I did not have to change anything in the other AS?
            • 3. Re: Buggy Action Script
              Andreq85 Community Member
              on (enterFrame) {
              y = y*accel+(_root.ykoord-_y)*rate;
              _y += y;
              x = x*accel+(_root.xkoord-_x)*rate;
              _x += x;
              if (Math.abs(_root.ykoord-_y)<1) {
              _y = _root.ykoord;
              }
              if (Math.abs(_root.xkoord-_x)<1) {
              _x = _root.xkoord;
              }
              }

              x alone and y alone is a reserved property for component... it may not help to use them as var...

              could you put the actualy error code here if there is still one ?
              • 4. Re: Buggy Action Script
                gold987987987 Community Member
                No more error code. I change the AS to this and it works, but it moves really slow. Any ideas?

                onClipEvent(load) {
                accel = _root.accel;
                rate = _root.rate;
                }
                onClipEvent(enterFrame) {
                y = y*accel+(_root.ykoord-_y)*rate;
                _y += y;
                x = x*accel+(_root.xkoord-_x)*rate;
                _x += x;
                if (Math.abs(_root.ykoord-_y)<1) {
                _y = _root.ykoord;
                }
                if (Math.abs(_root.xkoord-_x)<1) {
                _x = _root.xkoord;
                }
                }