9 Replies Latest reply on Feb 20, 2007 10:31 PM by Visionology

    Tween Class fading loop, acting up with multiple clicks

    Visionology Level 1
      Hello all,
      I have a thumbnail gallery that I am working on. The gallery works fine and when you click the thumbnails it loads the respective swf into the container.picture movieclip.

      I have used the tween class to fade a set of clips in a single swf in a loop infinitely.

      The problem lies in that when you click the thumbnail, the swf loads fine and everything plays great (THE FIRST TIME) then if you repeatedly click the same thumbnail the tween class acts up and the fading gets strange, the timing messed up and it starts to almost layer the clicks on each other.

      The problem seems VERY similar to when you use a setInterval and don't clear the interval and it starts to overlay them upon multiple clicks.

      Is there a way to clear the tween class, delete it at run time, etc? This problem is driving me up the wall.

      I have provided my code below (just for the tween class, not for the navigation) to hopefully spark an idea.


      Thanks!
      Neil



        • 1. Re: Tween Class fading loop, acting up with multiple clicks
          kglad Adobe Community Professional & MVP
          what are those rewind() methods supposed to do? and if you're calling playFades without resetting n to zero you're going to have a mess.
          • 2. Re: Tween Class fading loop, acting up with multiple clicks
            Visionology Level 1
            Oh, sorry that was left in by accident as one of my attempts to fix the problem. I just removed them from the post above.

            I thought that perhaps using rewind() on one of the thumbnail buttons and pointing them to _root.container.picture.tween_handler1.rewind(); and _root.container.picture.tween_handler2.rewind(); would fix the problem by rewinding each clip on the initial play but I can't seem to get anything to work.
            • 3. Re: Tween Class fading loop, acting up with multiple clicks
              kglad Adobe Community Professional & MVP
              the rewind() methods won't cause the problem. they do nothing in your code. i was just checking to see if they were supposed to do something.

              the main issue is n. and actually, now that i look at that code more carefully just what are you trying to do? that looks like an infinite loop that's going to fade-out, then fade-in each array member one by one, repeatedly. is that what you want?
              • 4. Re: Tween Class fading loop, acting up with multiple clicks
                Visionology Level 1
                Heres is a quick synopsis of what is going on.

                This is a single swf clip that holds an array of movie clips. Each movie clip contains an image. It fades the first clip in and then out and so forth through the clips in the array. Then it loops infinitely.

                The swfs will then be a part of a larger portfolio and will load into a container when clicked on by a thumbnail.

                I actually have just put up a test version so you can see what I mean. If you go to http://www.visim.com/testgallery/portfolio.html it will load the "print" thumbnails automatically. Click on the top right thumbnail and it will be exactly what we are talking about here using the code above. It works perfect *until* you try to click on the same button again or rapidly click to another thumbnail and back to that one.

                It almost looks like it is repeating the tween class each time you click the buttton.

                Thanks
                • 5. Re: Tween Class fading loop, acting up with multiple clicks
                  Visionology Level 1
                  does anyone have any other ideas?

                  would it be recommended to try a different approach for the same objective I am trying to achieve with the fading in and out movieclips?
                  • 6. Re: Tween Class fading loop, acting up with multiple clicks
                    kglad Adobe Community Professional & MVP
                    i don't see any looping fades if i press dictaphone, for example. so, what's the posted code above have to do with the code that's executing when a button is pressed.

                    i do see the problem with rapid clicks.
                    • 7. Re: Tween Class fading loop, acting up with multiple clicks
                      Visionology Level 1
                      Only the top right thumbnail is currently setup using the code I have above.

                      I didn't go through the hassle of doing the others yet until I figure out the problem. The other images in all the other sections are .jpg files pulled from a xml file so ignore them.

                      Try clicking on the top right thumbnail in print, click on the left one quickly and then back to the right. It will get all messed up. Also like you said rapidly clicking it causes it to keep overwriting itself instead of just having one copy that starts from the beginning.

                      How do you make sure that if you rapidly click that same thumbnail only 1 copy is playing and it has been reset to the beginning? Is it something that can be put into that .swf or would it have to be in the code for the thumbnail buttons?

                      Also does the object variables for the tween class have to be declared outside the function that I used to play the fades if I want to access them from the thumbnails?

                      Thanks
                      • 8. Re: Tween Class fading loop, acting up with multiple clicks
                        kglad Adobe Community Professional & MVP
                        pass the movieclips that want to cycle through when you call tweenStartF():

                        • 9. Re: Tween Class fading loop, acting up with multiple clicks
                          Visionology Level 1
                          I wish it solved the problem. The new code you have shown works but it still does the same thing as before, it seems there is no way to rewind or stop the previous from playing.

                          If you were going to do something like this yourself would you use Tween Objects or would you use a different method like set intervals, etc? I may look into alternates since this doesn't seem to be working even though it is 95% there.

                          I am afraid of a prospective employer clicking on a button repeatedly.

                          Thanks for all the help.