1 Reply Latest reply on Jul 28, 2006 9:05 AM by Newsgroup_User

    _rotation help

    mikeha
      something funky is going on. I'm using this code and it works until you have clicked in the 3rd time and then it just starts rotating around and around until you click it 3 more time and then it stops and acts correctly for another 3 clicks. WHY?

      onClipEvent (load) {
      movieclip = 0;
      div = 2;
      }

      onClipEvent (enterFrame) {
      _rotation += (movieclip-_rotation)/div;

      this.onPress = function() {
      startDrag(this);
      if (dropped == 1) {
      movieclip= (movieclip += 90);
      }
      }
      }
        • 1. Re: _rotation help
          Level 7

          "mikeha" <webforumsuser@macromedia.com> wrote in message
          news:ead8f7$4dt$1@forums.macromedia.com...
          > something funky is going on. I'm using this code and it works until you
          > have
          > clicked in the 3rd time and then it just starts rotating around and around
          > until you click it 3 more time and then it stops and acts correctly for
          > another
          > 3 clicks. WHY?
          >
          > onClipEvent (load) {
          > movieclip = 0;
          > div = 2;
          > }
          >
          > onClipEvent (enterFrame) {
          > _rotation += (movieclip-_rotation)/div;
          >
          > this.onPress = function() {
          > startDrag(this);
          > if (dropped == 1) {
          > movieclip= (movieclip += 90);
          > }
          > }
          > }
          >

          This link should provide you with some insight.

          http://www.peachpit.com/articles/article.asp?p=30617&seqNum=2&rl=1

          By the way... when is "dropped" being set to 1? You might want to use the
          this.onRelease event handler to do your increase in rotation... something
          like...

          onClipEvent(enterFrame) {
          ...
          ...
          ...
          this.onPress = function() {
          startDrag(this);
          }

          this.onRelease = function() {
          stopDrag();
          movieclip += radianValue;
          }
          }

          Also, might want to use the modulus (%) operator to keep your radians
          between 0 and 2pi.

          HTH