i'm trying to apply the same transition (currently on one frame of the
timeline) to several images on individual frames. it was suggested earlier to
use an array of all my mc instance names and apply a for loop.
i've attached the code, but it seems to only work on the frame in which it
sits.
just wondering if there is something missing in the code that would apply it
to all images.
thanks in advance.
import mx.transitions.Tween;
import mx.transitions.easing;
var mcNames:Array = new Array(adv1_mc, adv2_mc, adv3_mc, adv4_mc, adv5_mc,
adv6_mc, adv7_mc, adv8_mc, adv9_mc, adv10_mc, adv11_mc, adv12_mc, adv13_mc,
adv14_mc, adv15_mc, adv16_mc, adv17_mc, adv18_mc, adv19_mc, adv20_mc, adv21_mc,
adv22_mc, adv23_mc, adv24_mc, adv25_mc, adv26_mc, adv27_mc, adv28_mc, adv29_mc);
for(var i = 0; i<mcNames.length; i++){
var t:Tween = new Tween(mcNames[i], "_alpha", Strong.easeIn, 0, 100, 1,
true);
};
Noelbaland - 15 Jul 2008 05:27 GMT
Hello there,
Instead of using an array to look for your movieclips, you could try using a
for-in loop to find your mc's and tween them. Then you could put it in a
function and use that function on different frames.
Have a look at the script below and read the comments for more.
dtodab - 15 Jul 2008 13:49 GMT
thanks for the script and comments.
just applied your suggestion to the site - it seems to do the same thing as
before. it only works for the first frame, and there seems to be a bit of an
odd delay before the tween kicks in.
a quick general question: when you import the tween classes in the beginning,
does that apply to the whole timeline? or do you need to do that on every frame
where you want to use those classes?
Noelbaland - 16 Jul 2008 05:31 GMT
Yeah, you pretty much have to put the import statements on every frame that you
want to fade in your clips. But by referring to them in a function (like the
above) you can pretty much call it from anywhere in the timeline.
I'm not sure why yours is not working for you but I have a working example
here if you want to take a look. You can download the example if you want to
take a look and compare it to your Flash movie.
dtodab - 17 Jul 2008 03:09 GMT
thanks for the alternate code example.
everything seems to work fine with your example.
however, an interesting delay happened. using the fadeclips seems to pause
each image transition by about a 1/2 second (meaning it takes an extra 1/2
second before an image begins to appear). not a huge deal, just a tad slower
than doing it with the current code on each frame. do you think there is anyway
to control this?
import mx.transitions.Tween;
import mx.transitions.easing;
new Tween(food4_mc, "_alpha", Strong.easeIn, 0, 100, 1, true);
dtodab - 17 Jul 2008 03:15 GMT
just tried something and it seems to fix the problem.
i removed the .* at the end of import mx.transitions.easing;
seems to have taken out the short delay before each transition.