Halp! I'm an AS3 newbie
I'm working on my new website, but I havent worked with flash for years and I have pretty much forgotten everything. Now I want upgrade myself and learn some AS3, but its doing my head in. So the little AS2 I remember cant even be used anymore.
Basically what I cant get to work is having a rotator that fades in and out between X number of movieclips.
And I dont even know where to start. Any tutorial or help in the thread is greatly appreciated. It needs to be absolutely basic. Ie.
myClip1 Fade in -> wait ->
myClip1 Fade out, myClip2 Fade in -> wait ->
myClip2 Fade out, myClip3 Fade in -> wait ->
myClip3 Fade out, myClip1 Fade in -> etc. etc.
God Im such a code newbie :S
You can use something like TweenMax to handle the timing / tweening. With that in mind:
import com.greensock.easing.*;
import com.greensock.*;
import flash.display.*;
var currentImage : MovieClip;
var images : Array = [ image0, image1, image2, image3, image4 ]; // Just a bunch of MovieClips. Assumes their beginning alpha value is 0
var imageIndex : int = 0;
function fadeImageIn ( image : MovieClip ) : void
{
var delay : Number = 0;
if ( currentImage != null )
{
TweenMax.to ( currentImage, 1, { alpha : 0 } );
delay = 1;
}
currentImage = image;
TweenMax.to ( currentImage, 1, { alpha : 1, delay : delay } );
imageIndex++;
if ( imageIndex > images.length - 1 ) imageIndex = 0;
var nextImage : MovieClip = images [ imageIndex ];
TweenMax.delayedCall ( delay + 2, fadeImageIn, [ nextImage ] );
}
fadeImageIn ( images[0] );
Hope it helps.
lith.
I use Pages.as, let me know if you need an example posted, or if the hx/js example checked in which can be seen here is enough photoswipe
Thanks for the help guys, your solution looks kinda advanced for a newbie like me. But I will take a closer look this weekend and see if I have any questions to the execution.
Ohh tween max has a lot of features. I like!