Read in english (Automatic translation wiht Google)
We can find a hundred of free javascript widgets maded with Scriptaculous, Prototype, MooTools, JQuery and many others. But in Flash we don’t had all this code share. It’s very often we find websites selling components maded in Flash( with almost all closed source ) instead blogs or sites that share solutions with other developers.
Of course that is not a rule, we had many good sites sharing code and solutions or teaching Flash, and thinking on this way we will try share, when we can, solutions four our AS3 projects.
We will start sharing the SlideShow component that we made for last two project we working now.
See here a sample:
Sample
It’s a simple gallery that uses effects and transitions from TransitionManger Adobe’s class. All images are loaded from XML file.
Below a code usage sample:
1
2
3
4
5
6
7
8
9
10
11
|
import com.slideshow.SlideShow;
var slideShow:SlideShow = new SlideShow(slideShowContainer,"assets/xmlfile.xml");
slideShow.params.displayControls = true;
slideShow.params.displayPreloader = true;
slideShow.params.preloaderBgColor = 0x00FFFF;
slideShow.params.randomTransition = true;
slideShow.params.transitions = ["Blinds","Fade","Fly","Iris","Pixel","Wipe","Zoom"];
slideShow.createSlides();
slideShowContainer.addChild(slideShow);
|
Explanation:
Line 1 : Create our SlideShow and passing to construct a xml path. We can pass, as option parameter, the time to change image (default is 7 seconds).
Line 2 : Property to make visible, or not, pause, next and previous buttons
Liine 3 : Show preloader bar.
Line 4 : Preloader color.
Line 5 : Use random transitions.
Line 6 : Possible effects
Line 7 : Create SlideShow
Line 8 : Add slideShow on movieclip or sprite.
XML content:
1
2
3
4
5
6
7
8
9
10
11
12
13
|
<slideshow>
<slide id="1">
<url>assets/images/01.jpg</url>
</slide>
<slide id="2">
<url>assets/images/02.jpg</url>
</slide>
.
.
.
</slideshow>
|
It’s possible create custom effects, just adding the new effect in PictureLoader.as class.
Important remember this component was developed in short time and probably some code can be refactored and changed.
Fell free to do that and we wil be happy with contribuitions on functionality or effects :D.
Below a Zip file with two classes(PictureLoader.as e SlideShow.as) and usage sample:
Download
Deixe um comentário