Simple ActionScript 3 Slideshow Engine
Simple ActionScript 3 Slideshow engine. This class file simply creates a slideshow that in its current setup, cross fades between each image. The class uses external images and is in fact, abstracted from sourcing any images. It is up to you to provide the class with an array of image URLs for it to use. This is a reworking of an earlier class, which has now been removed from this site.
Class currently uses tweenLite to handle the alpha transitions. However, this is simply replaced via a simple timer function. But I’ve left tweenLite in the class so that people can change the transitions to other types, like, blur, photoFlash etc easily by changing the tween type. If you just want an alpha fade and don’t use tweenLite elsewhere in your project, replace the tweenLite functionality with your own alpha fading transition. An example of which, is commented out in the class source code.
Class settings are instance based, which you access via getters/setters. So you can have muliple slideshow instances running at the same time
Class Features
- External Images
- Control over image cross fade time
- Control over image display time
- Linear or random image progression
- Automatic (timer) progression, or via mouse event
- Looping or play once
- Pause / Resume the slideshow in auto mode
Via setters, you can access and set the following properties for each slideshow instance..
xFadeTime: get/set – DataType:uint – Sets crossfade time or transition time between two slides in seconds
imageTime: get/set – DataType:uint – Sets total image display time, not including xFadeTime in seconds
slidesPlayRandom: get/set – DataType:Boolean – Sets the linear or random play order for slides. Set to true for random playback.
slidesLoop: get/set – DataType:Boolean – Sets whether the slideshow loops, or stops at end of images array. True = looping
slidesAutoPlay: get/set – DataType:Boolean – Sets whether the slides use the timer to auto progress, or whether a user must click on the slides to progress. True = autoPlay
Look in the demo .fla’s document class for examples of listening for the classes various events. You can listen for Open, Progress, Complete and SlideShowComplete events at the class instance level. You can also dispatch a pause and a resume event to the class. Which will pause / resume the class if it is in automatic mode.
View Example
http://www.noponies.com/dev/as3_xslideshow/
Source Files
http://www.blog.noponies.com/wp-content/uploads/as3_xslideshow_1_2.zip
Dependencies
tweenLite
