phifunk Posted May 20, 2010 Share Posted May 20, 2010 folks I inherited this code which runs an image carousel in flash cs3. The carousel is at the end of the flash movie but keeps cycling. I just need the tween to stop. here is the code. thanks much import gs.TweenLite; var CarouselCounter:Number; var CarouselArray:Array = new Array("Image1","Image2"); CarouselCounter = 0; NextCarouselImage = function() { //creates empty holder var container:MovieClip = Carousel.createEmptyMovieClip("container", getNextHighestDepth()); container._alpha = 0; container._xscale = 100; container._yscale = 100; //loads container.attachMovie( CarouselArray[CarouselCounter], "newContainer", getNextHighestDepth()); TweenLite.to(container, .5, {_alpha:100, overwrite:false} ); TweenLite.to(container, .5, {_alpha:0, delay:4.5, overwrite:false} ); var CarouselInterval = setInterval(Next, 5*1000); function Next() { clearInterval(CarouselInterval); if (CarouselCounter >= CarouselArray.length - 1) { CarouselCounter = 0 } else { CarouselCounter++; } NextCarouselImage(); } } NextCarouselImage(); Link to comment Share on other sites More sharing options...
GreenSock Posted May 20, 2010 Share Posted May 20, 2010 This isn't really a tweening issue, but if you don't want it to keep going to the next one, it looks like you'd probably need to remove this line in your code: var CarouselInterval = setInterval(Next, 5*1000); Or if you want it to go through all the images once, you'd need to restructure your conditional logic and change this: if (CarouselCounter >= CarouselArray.length - 1) { CarouselCounter = 0 } else { CarouselCounter++; } NextCarouselImage(); to this: if (CarouselCounter >= CarouselArray.length - 1) { CarouselCounter = 0 } else { CarouselCounter++; NextCarouselImage(); } I'm not positive that's what you need, but hopefully it gives you a nudge in the right direction. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now