AS3 Tween - problem fading two movieclips on top of each other

Hi,

I am trying to achieve what at first seemed a quite simple task:

To get Flash AS3 to dynamically fade a movieclip in, then fade another one over the top, on a different layer. To give a 'slideshow' effect, images being fed by XML...

I have tried different approaches and the deadline is looming.  First I simply loaded the images as childs of a movieclip onto a stack, and faded them in - this worked OK, but kept 'hanging'/ not working properly when live.

so I'm exploring using two 'layers' - one on top of the other, that fade in/out - I set up a similar thing on the timeline with a movie in the old days!

Again, Flash seems to be tripping up with the 'Tween' - not rendering the scene when I have two tweens on stage at the same time.

Please help!

If there is a better 'Tween' component you can recommend that can definately handle two or more tweens at the same time?

Have a look at my code - can you see where there may be an issue - all the variables are being fed from local Arrays, that are built from XML data?

Please help!

Nick





public function sc_2_image_bg_in():void{
							var thisLoader:Loader = new Loader();
							thisLoader.load(new URLRequest(sc_2_bg_img_Arr[sc_2_bg_counter]));
							sc_2_image_bg.addChild(thisLoader);
							var sc_2_img_in = new Tween(thisLoader, "alpha", Strong.easeOut, 0, 1, pace_arr[sc_2_bg_counter], false);
								sc_2_img_in.addEventListener(TweenEvent.MOTION_STOP, sc_2_image_fg_in);
							sc_2_bg_counter++;
							}
							
						public function sc_2_image_bg_out(e:TweenEvent):void{
							var sc_2_bg_img_out = new Tween(sc_2_image_bg, "alpha", Strong.easeOut, 1, 0, pace_arr[sc_2_bg_counter], false);
								sc_2_bg_img_out.stop();
								sc_2_bg_img_out.addEventListener(TweenEvent.MOTION_START, sc_2_image_fg_in);
								sc_2_bg_img_out.start();
								
								
									//var sc_2_fg_img_in = new Tween(sc_2_image_fg, "alpha", Strong.easeOut, 0, 1, pace_arr[sc_2_bg_counter], false);
								//sc_2_bg_img_out.addEventListener(TweenEvent.MOTION_STOP, sc_2_image_remove);
								
							}
						public function sc_2_image_remove(e:TweenEvent):void{
							sc_2_image_bg.removeChildAt(0);//??
							trace(sc_2_image_bg.numChildren);
							}
							
						public function sc_2_image_fg_in(e:TweenEvent):void{
							var thisLoader:Loader = new Loader();
							thisLoader.load(new URLRequest(sc_2_fg_img_Arr[sc_2_fg_counter]));
							sc_2_image_fg.addChild(thisLoader);
							var sc_2_fg_img_in = new Tween(sc_2_image_fg, "alpha", Strong.easeIn, 0, 1, pace_arr[sc_2_fg_counter], false);	
							sc_2_fg_counter++;
							}

Open in new window

LVL 1
nimuseAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rascalpantsCommented:
I would highly recommend using TweenMax... it is free, and becoming the industry standard for code based animation...

for AS 3.0:   http://blog.greensock.com/tweenmaxas3/

you just need to make sure to use the OverwriteManager...

like this...

import gs.TweenMax;
import gs.easing.*;
import gs.OverwriteManager;

OverwriteManager.init( OverwriteManager.NONE );

...

then you would use the simple TweenMax.to() method as listed on the above site.


rp
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CyanBlueCommented:
gTween also is a good and light one that I recommend...  ;)

CyanBlue
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development Software

From novice to tech pro — start learning today.