Loading ...
Sorry, an error occurred while loading the content.

having trouble with multiple clicks

Expand Messages
  • th3w3bguy
    nice library! anyway, i ve modified one of the animation/motion examples and i m having some trouble. my code is at the end of the message. i have a feeling
    Message 1 of 4 , Feb 14, 2006
    • 0 Attachment
      nice library!

      anyway, i've modified one of the animation/motion examples and i'm
      having some trouble. my code is at the end of the message. i have a
      feeling that i'm missing something anyway, but here goes.

      i'm using 2 input buttons to control animating this div called
      'slider'. one button slides it 100 px to the right, the other 100 px
      to the left. it works beautifully, unless the user clicks one of the
      buttons WHILE the div is still in motion -- in that case it starts
      from the point it is at and animates again.

      what i want is to disable the user interface while an animation is
      happening.

      i tried removing the listeners (position is marked in the code as /* r
      */) for the buttons, and then adding them again (/* a */) but no dice.
      does anyone know what i'm doing wrong?


      YAHOO.namespace('slider.box');

      YAHOO.slider.box.init = function() {

      var r_attributes = {
      points: { by: [100, 0] }
      }
      var l_attributes = {
      points: { by: [-100, 0] }
      }

      var right = new YAHOO.util.Motion('motion', r_attributes, .4,
      YAHOO.util.Easing.easeOut);
      var left = new YAHOO.util.Motion('motion', l_attributes, .4,
      YAHOO.util.Easing.easeOut);

      var r_animate = function(e) {
      /* r */
      right.animate();
      /* a */
      return false;
      }

      var l_animate = function(e) {
      /* r */
      left.animate();
      /* a */
      return false;
      }

      YAHOO.util.Event.addListener('right_button', 'click', r_animate);
      YAHOO.util.Event.addListener('left_button', 'click', l_animate);

      }

      YAHOO.util.Event.addListener(window, 'load', YAHOO.slider.box.init);
    • Matt Sweeney
      Hello th3w3bguy, Thanks for the feedback. You can check whether the animation is currently running via the isAnimated() method. When right is called to
      Message 2 of 4 , Feb 14, 2006
      • 0 Attachment
        Hello th3w3bguy,

        Thanks for the feedback.

        You can check whether the animation is currently running via the
        isAnimated() method.

        When right is called to animate, you can check whether left is currently
        animated before calling right.animate(). Same for left.

        Something like:

        var r_animate = function(e) {
        if ( !left.isAnimated() ) {
        right.animate();
        }

        return false;
        }

        Matt

        th3w3bguy wrote:

        >nice library!
        >
        >anyway, i've modified one of the animation/motion examples and i'm
        >having some trouble. my code is at the end of the message. i have a
        >feeling that i'm missing something anyway, but here goes.
        >
        >i'm using 2 input buttons to control animating this div called
        >'slider'. one button slides it 100 px to the right, the other 100 px
        >to the left. it works beautifully, unless the user clicks one of the
        >buttons WHILE the div is still in motion -- in that case it starts
        >from the point it is at and animates again.
        >
        >what i want is to disable the user interface while an animation is
        >happening.
        >
        >i tried removing the listeners (position is marked in the code as /* r
        >*/) for the buttons, and then adding them again (/* a */) but no dice.
        >does anyone know what i'm doing wrong?
        >
        >
        >YAHOO.namespace('slider.box');
        >
        >YAHOO.slider.box.init = function() {
        >
        > var r_attributes = {
        > points: { by: [100, 0] }
        > }
        > var l_attributes = {
        > points: { by: [-100, 0] }
        > }
        >
        > var right = new YAHOO.util.Motion('motion', r_attributes, .4,
        >YAHOO.util.Easing.easeOut);
        > var left = new YAHOO.util.Motion('motion', l_attributes, .4,
        >YAHOO.util.Easing.easeOut);
        >
        > var r_animate = function(e) {
        > /* r */
        > right.animate();
        > /* a */
        > return false;
        > }
        >
        > var l_animate = function(e) {
        > /* r */
        > left.animate();
        > /* a */
        > return false;
        > }
        >
        > YAHOO.util.Event.addListener('right_button', 'click', r_animate);
        > YAHOO.util.Event.addListener('left_button', 'click', l_animate);
        >
        >}
        >
        >YAHOO.util.Event.addListener(window, 'load', YAHOO.slider.box.init);
        >
        >
        >
        >
        >
        >
        >Yahoo! Groups Links
        >
        >
        >
        >
        >
        >
        >
        >
        >
        >
        >
      • BEVERLY MILES
        i do not know why u are sending me this email i have not contacted u beverlymiles3851@sbcglobal.net Matt Sweeney wrote: Hello
        Message 3 of 4 , Feb 14, 2006
        • 0 Attachment
          i do not know why u are sending me this email i have not contacted u
          beverlymiles3851@...
          Matt Sweeney <msweeney@...> wrote:
          Hello th3w3bguy,

          Thanks for the feedback.

          You can check whether the animation is currently running via the
          isAnimated() method.

          When right is called to animate, you can check whether left is currently
          animated before calling right.animate().  Same for left.

          Something like:

             var r_animate = function(e) {
                if ( !left.isAnimated() ) {
                   right.animate();
                }

                return false;
             }

          Matt

          th3w3bguy wrote:

          >nice library!
          >
          >anyway, i've modified one of the animation/motion examples and i'm
          >having some trouble. my code is at the end of the message. i have a
          >feeling that i'm missing something anyway, but here goes.
          >
          >i'm using 2 input buttons to control animating this div called
          >'slider'. one button slides it 100 px to the right, the other 100 px
          >to the left. it works beautifully, unless the user clicks one of the
          >buttons WHILE the div is still in motion -- in that case it starts
          >from the point it is at and animates again.
          >
          >what i want is to disable the user interface while an animation is
          >happening.
          >
          >i tried removing the listeners (position is marked in the code as /* r
          >*/) for the buttons, and then adding them again (/* a */) but no dice.
          >does anyone know what i'm doing wrong?
          >
          >
          >YAHOO.namespace('slider.box');
          >
          >YAHOO.slider.box.init = function() {
          >
          >   var r_attributes = {
          >      points: { by: [100, 0] }
          >   }
          >   var l_attributes = {
          >      points: { by: [-100, 0] }
          >   }
          >  
          >   var right = new YAHOO.util.Motion('motion', r_attributes, .4,
          >YAHOO.util.Easing.easeOut);
          >   var left  = new YAHOO.util.Motion('motion', l_attributes, .4,
          >YAHOO.util.Easing.easeOut);
          >
          >   var r_animate = function(e) {
          >      /* r */
          >      right.animate();
          >      /* a */
          >      return false;
          >   }
          >
          >   var l_animate = function(e) {
          >      /* r */
          >      left.animate();
          >      /* a */
          >      return false;
          >   }
          >
          >   YAHOO.util.Event.addListener('right_button', 'click', r_animate);
          >   YAHOO.util.Event.addListener('left_button', 'click', l_animate);
          >
          >}
          >
          >YAHOO.util.Event.addListener(window, 'load', YAHOO.slider.box.init);
          >
          >
          >
          >
          >
          >
          >Yahoo! Groups Links
          >
          >
          >
          >
          >
          >
          >
          >
          >

          >


        • gerry@xltopia.co.uk
          Beverly, You are subscribed to the ydn-javascript Yahoo Group which is why you got the message. Unsubscribe if you don t wish to continue membership. Regards,
          Message 4 of 4 , Feb 14, 2006
          • 0 Attachment

            Beverly,

             

            You are subscribed to the ydn-javascript Yahoo Group which is why you got the message.  Unsubscribe if you don’t wish to continue membership.

             

            Regards,

             

            Gerry

             

             


            From: ydn-javascript@yahoogroups.com [mailto:ydn-javascript@yahoogroups.com] On Behalf Of BEVERLY MILES
            Sent: 14 February 2006 21:40
            To: ydn-javascript@yahoogroups.com
            Subject: Re: [ydn-javascript] having trouble with multiple clicks

             

            i do not know why u are sending me this email i have not contacted u
            beverlymiles3851@...
            Matt
            Sweeney <msweeney@...> wrote:

            Hello th3w3bguy,

            Thanks for the feedback.

            You can check whether the animation is currently running via the
            isAnimated() method.

            When right is called to animate, you can check whether left is currently
            animated before calling right.animate().  Same for left.

            Something like:

               var r_animate = function(e) {
                  if ( !left.isAnimated() ) {
                     right.animate();
                  }

                  return false;
               }

            Matt

            th3w3bguy wrote:

            >nice library!
            >
            >anyway, i've modified one of the animation/motion examples and i'm
            >having some trouble. my code is at the end of the message. i have a
            >feeling that i'm missing something anyway, but here goes.
            >
            >i'm using 2 input buttons to control animating this div called
            >'slider'. one button slides it 100 px to the right, the other 100 px
            >to the left. it works beautifully, unless the user clicks one of the
            >buttons WHILE the div is still in motion -- in that case it starts
            >from the point it is at and animates again.
            >
            >what i want is to disable the user interface while an animation is
            >happening.
            >
            >i tried removing the listeners (position is marked in the code as /* r
            >*/) for the buttons, and then adding them again (/* a */) but no dice.
            >does anyone know what i'm doing wrong?
            >
            >
            >YAHOO.namespace('slider.box');
            >
            >YAHOO.slider.box.init = function() {
            >
            >   var r_attributes = {
            >      points: { by: [100, 0] }
            >   }
            >   var l_attributes = {
            >      points: { by: [-100, 0] }
            >   }
            >  
            >   var right = new YAHOO.util.Motion('motion', r_attributes,
            .4,
            >YAHOO.util.Easing.easeOut);
            >   var left  = new YAHOO.util.Motion('motion',
            l_attributes, .4,
            >YAHOO.util.Easing.easeOut);
            >
            >   var r_animate = function(e) {
            >      /* r */
            >      right.animate();
            >      /* a */
            >      return false;
            >   }
            >
            >   var l_animate = function(e) {
            >      /* r */
            >      left.animate();
            >      /* a */
            >      return false;
            >   }
            >
            >   YAHOO.util.Event.addListener('right_button', 'click',
            r_animate);
            >   YAHOO.util.Event.addListener('left_button', 'click',
            l_animate);
            >
            >}
            >
            >YAHOO.util.Event.addListener(window, 'load', YAHOO.slider.box.init);
            >
            >
            >
            >
            >
            >
            >Yahoo! Groups Links
            >
            >
            >
            >
            >
            >
            >
            >
            >

            >

             

             

            SPONSORED LINKS

            C programming language

            Computer programming languages

            Java programming language

            The c programming language

            C programming language

            Concept of programming language

             


            YAHOO! GROUPS LINKS

             

             


          Your message has been successfully submitted and would be delivered to recipients shortly.