Jump to content
Search Community

Anyway to replace a MC reference in a TweenLite/TweenMax?

Choochoo test
Moderator Tag

Recommended Posts

I am converting an entire slideshow into TweenMax, I love it, its way easier than what was in before

 

Problem: When loading dynamic pictures (large pictures) it lags the animation on every load. It loads the picture, attachs it to a MC, then throws it to the animation, there is say, 70 pictures, and I tell it to start on the 3rd picture, so everytime a new picture is loaded, it lags the animation slightly. Is there a better way of doing this or tricks of optimization?

 

Thanks!

 

function add_to_mc(mc:movieclip)
{
time = 14;//total duration of one picture
fadetime = 2;//how long fades takes
maintl.addLabel(i.toString(), maintl.duration);
if (maintl.duration == 0)
{
maintl.append(TweenLite.to(mc, time, {onStart:checkCarousel,ease:Linear.easeNone, _x:nEndLeft, _y:nEndTop, _width:nEndWidth, _height:nEndHeight } ));
}
else
{
maintl.append(TweenMax.to(mc, 0.1, { _visible:true } ), -fadetime);
maintl.append(TweenLite.to(mc, time, {onStart:checkCarousel,ease:Linear.easeNone,_x:nEndLeft, _y:nEndTop, _width:nEndWidth, _height:nEndHeight } ), -fadetime);
}
maintl.append(TweenMax.to(mc, fadetime, {ease:Linear.easeNone,autoAlpha:0 } ),-fadetime);
}
}

 

edit: I was maybe thinking of creating the entire Timeline with fake movieclips with predermined sizes, then just inserting the pictures into them, so nothing new is created while playing the timeline

Link to comment
Share on other sites

It's a bit tough to say for sure without seeing the rest of your app/code, but I'd make sure that you set the images' _visible property to false initially in order to improve rendering performance. I noticed you're using autoAlpha to fade them out which is great because it'll automatically toggle them to _visible:false when alpha hits 0.

 

Also, could you describe exactly what you mean by "it lags the animation slightly"? I wonder if you're starting your animation before the image is even loaded or something and then it appears to pop in without being smooth because the tween was already mostly done before the actual MovieClip content was loaded on the stage. Just a thought. Again, it's much easier to troubleshoot when there's a simple FLA that we can publish and see the problem happening for ourselves.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...