2 Replies Latest reply on Oct 29, 2007 4:42 PM by EnterFrame

    TWEENING with Sliders!

    izhegazy
      Hi everyone,

      Download FLA Here

      so I have this very simple slider which when you drag it, it switches between 5 MCs. What I want to do is when the slider is at the point where it should switch the MCs a simple fade tweening happens.

      I have been going crazy trying to figure it out. Please any help is very much appreciated. I am sure it's an easy fix, but I really can't figure it out.

      Thanks a Million!!



      Here's the CODE that's on the frame 1 in the stage:

        • 1. Re: TWEENING with Sliders!
          kglad Adobe Community Professional & MVP
          do you really want each of those blocks of code to execute when sliding.ratio>80?

          if you only the last block to execute (and only one block for each ratio), put the >80 first and use else if statements instead of if statements and use a boolean to determine if the tween is already started and need not be re-started. reset the boolean somewhere if you want to allow the slider to be reused.
          • 2. Re: TWEENING with Sliders!
            EnterFrame
            Have not looked at the FLA but you probably had the following in mind:

            if (sliding.ratio >= 0 && sliding.ratio < 20)
            {
            new Tween(mc01, "_alpha", Regular.easeOut, 0, 100, 1, true);
            mc02._alpha = 0;
            mc03._alpha = 0;
            mc04._alpha = 0;
            mc05._alpha = 0;
            }
            else if (sliding.ratio >= 20 && sliding.ratio < 40)
            {

            new Tween(mc01, "_alpha", Regular.easeOut, 100, 0, 1, true);
            new Tween(mc02, "_alpha", Regular.easeOut, 0, 100, 1, true);
            mc03._alpha = 0;
            mc04._alpha = 0;
            mc05._alpha = 0;
            }
            else if (sliding.ratio >= 40 && sliding.ratio < 60)
            {
            mc01._alpha = 0;
            new Tween(mc02, "_alpha", Regular.easeOut, 100, 0, 1, true);
            new Tween(mc03, "_alpha", Regular.easeOut, 0, 100, 1, true);
            mc04._alpha = 0;
            mc05._alpha = 0;
            }
            else if (sliding.ratio >= 60 && sliding.ratio < 80)
            {
            mc01._alpha = 0;
            mc02._alpha = 0;
            new Tween(mc03, "_alpha", Regular.easeOut, 100, 0, 1, true);
            new Tween(mc04, "_alpha", Regular.easeOut, 0, 100, 1, true);
            mc05._alpha = 0;
            }
            else
            {
            mc01._alpha = 0;
            mc02._alpha = 0;
            mc03._alpha = 0;
            new Tween(mc04, "_alpha", Regular.easeOut, 100, 0, 1, true);
            new Tween(mc05, "_alpha", Regular.easeOut, 0, 100, 1, true);
            }