Fade In / Fade Out alpha tweens not working???

By Woodsy01 | Jul 10, 2009

actionscript3

Hi guys….I need another pair of eyes on this code cos it’s been doing my head in for the past 3 days!

I’ve got a function ‘onIntroFinished’ which starts two tweens (musicPlayerIntro and fullResetBtnIntro). After each tween, an eventlistener is added to that particular tween to see when it’s ended, so it can call on another function to start a new tween.

The first tweens complete within the ‘onIntroFinished’ function….however, they don’t go on to start the second tween in the ‘musicPlayerIntro2′ and ‘fullResetBtnIntro2′ functions?

The trace statements are getting called for the second tween functions, so they’re getting through to that point, but why aren’t the tweens starting? Ocassionally when I test it, the second tweens half work, fading out to 50% alpha, but then stop and stay visible, rather than fully fading out.

Is this necessarilly the best way to do a fade In/fade out alpha tween? ANy pointers greatly appreciated!

ActionScript Code:
private function onIntroFinished(event:Event = null):void             {                                 var musicPlayerIntro:Tween = new Tween(musicPlayer, “alpha”, Regular.easeIn, musicPlayer.alpha, 1, 1, true);                 musicPlayerIntro.addEventListener(TweenEvent.MOTION_FINISH,musicPlayerIntro2);                                 var fullResetBtnIntro:Tween = new Tween(fullResetBtn, “alpha”, Regular.easeIn, fullResetBtn.alpha, 1, 1, true);                 fullResetBtnIntro.addEventListener(TweenEvent.MOTION_FINISH,fullResetBtnIntro2);                             }// #*#*#*    end of onIntroFinished function                         private function musicPlayerIntro2(evetn:Event):void             {                 trace(“Second tween func for musicPlayer starting…”);                 var musicPlayerIntro2:Tween = new Tween(musicPlayer, “alpha”, Regular.easeOut, musicPlayer.alpha, 0, 4, true);             }// #*#*#*    end of musicPlayerIntro2 func                         private function fullResetBtnIntro2(event:Event):void             {                 trace(“Second tween func for fullResetBtn starting…”);                 var fullResetBtnIntro2:Tween = new Tween(fullResetBtn, “alpha”, Regular.easeOut, fullResetBtn.alpha, 0, 1, true);             }// #*#*#*    end of fullResetBtnIntro2 func

actionscript3

Please reply at our Forum

Leave a Comment

If you would like to make a comment, please fill out the form below.

Name (required)

Email (required)

Website

Comments

© 2007 ActionScript 3.0