Monday, March 22, 2010

TWEENING with Sliders!

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:



TWEENING with Sliders!
do you really want each of those blocks of code to execute
when sliding.ratio%26gt;80?



if you only the last block to execute (and only one block for
each ratio), put the %26gt;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.TWEENING with Sliders!
Have not looked at the FLA but you probably had the following
in mind:



if (sliding.ratio %26gt;= 0 %26amp;%26amp; sliding.ratio %26lt; 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 %26gt;= 20 %26amp;%26amp; sliding.ratio %26lt;
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 %26gt;= 40 %26amp;%26amp; sliding.ratio %26lt;
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 %26gt;= 60 %26amp;%26amp; sliding.ratio %26lt;
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);

}

No comments:

Post a Comment