ActionScript and Tweener

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • obarash
    New Member
    • Jan 2007
    • 25

    ActionScript and Tweener

    Hello,
    I'm using the Tweener Class.
    When I press a Button the list is sliding right and left (depends on the button I preeses).

    the Button is calling a function that use the following code:
    Tweener.addTwee n(this.list, {_x:list._x -(count * 60), time:0.8, transition:"eas eoutback"});

    My problem is when I press exactly before the tween is end, it starts a new tween and it end 10 pixels after it shouled stop.

    sombody knows how I can Control It.

    I tried use the function onComplete and to set a boolean veriable that allows tweening to true but it turns out that the onComplete funct is beeing executed before the tween is actually finished and the object stands in place.

    thank you,
    Oren
  • Motoma
    Recognized Expert Specialist
    • Jan 2007
    • 3236

    #2
    Your best bet is probably to build the animation yourself, provided it is not too complicated.

    Comment

    • obarash
      New Member
      • Jan 2007
      • 25

      #3
      Can't do it.

      I'm moving the list but I don't know the size of the list (It Is list of photos that I load from external folder), and when I got to the middle of the view I'm moving the pointer and not the list.

      I need to find a way to solve this problem, and I can't make the animation by myself and it's better to do the animation by code and not manualy by frames.

      so thank you but it don't help me so much.

      someone have another solution?

      Comment

      • Motoma
        Recognized Expert Specialist
        • Jan 2007
        • 3236

        #4
        I'm sorry, I misunderstood, and my suggestion was to do it in code :P
        In your function, set a flag to designate that you are in in the middle of a tween. When the tween is complete, unset that flag. At the beginning of the function, check that flag, and quit if it is set.

        Comment

        • obarash
          New Member
          • Jan 2007
          • 25

          #5
          First of all thank you,

          But I said that I have tried it all ready and it didn't work.

          Let me explain myself:
          I'm using the Tweener because I whant to move the object with an easeout.

          I don't know how to do it in code without the tweener because of the ease.

          In the Tweener there is a function that called onComplete so I have Tried to use it and set a flag when it done but it didn't workout.

          I really set the flage but the onComplete is beeing executed a 2 or 3 pixels before the movment is really finished so if I press the button again after a couple of times it relleay meesing up the movement.

          Comment

          • Motoma
            Recognized Expert Specialist
            • Jan 2007
            • 3236

            #6
            Have the onComplete function delay a small amount of time before setting the flag.

            Comment

            • obarash
              New Member
              • Jan 2007
              • 25

              #7
              Can you explain yourself please

              Comment

              • Motoma
                Recognized Expert Specialist
                • Jan 2007
                • 3236

                #8
                The onComplete function which sets the complete flag, have it pause for a second or two before doing so.

                Comment

                • obarash
                  New Member
                  • Jan 2007
                  • 25

                  #9
                  I solve the problem.
                  I added an onStartFunction that sets a flage to disable pressing the buttons.

                  The oncomplete it self wasn't enough.

                  Thank you i appreciate hte help.

                  can you explain me how to delay a function?
                  Sorry, but I didn't know there is a posbillity to do it, or you mean a timer?


                  *sorry for the bad english :-)

                  Comment

                  • Motoma
                    Recognized Expert Specialist
                    • Jan 2007
                    • 3236

                    #10
                    Yes, a timer is exactly what I mean.

                    Comment

                    Working...