Slideshow Component AS3 Documentation
Actionscript 3, Documentation, Flash Components December 19th, 2007Here is the documentation for working with the Slideshow Component AS3. I hope you’ll find it easy to use. If you have any questions, feel free to ask.
To preview and download the component go here.
Requirements
Authoring: Flash CS3
Actionscript: Actionscript 3 (Actionscript 2 version available here)
Player: Flash Player 9
Methods
loadImage(i:int)
example: mySlideshow.loadImage(3);
nextImage()
example: mySlideshow.nextImage();
prevImage()
example: mySlideshow.prevImage();
setSize(w:Number, h:Number)
example: mySlideshow.setSize(400, 300);
Properties
xmlPath
- type:String
- the path to the xml file
example: mySlideshow.xmlPath = “images.xml”;
scaleMode
- type:String
- available values: “exact fit”, “maintain aspect ratio”, “no scale”
- default value: “exact fit”
example: mySlideshow.scaleMode = “maintain aspect ratio”;
alignType
- type:String
- available values: “top-left”, “top-center”, “top-right”, “center-left”, “center”, “center-right”, “bottom-left”, “bottom-center”, “bottom-right”
- default value: “center”
example: mySlideshow.alignType = “top-left”;
autoLoad
- type:Boolean
- default value: true
example: mySlideshow.autoLoad = false;
setBorder
- type:Boolean
- default value: false
example: mySlideshow.setBorder = true;
borderThickness
- type:Number
- default value: 3
example: mySlideshow.borderThickness = 10;
borderAlpha
- type:Number
- default value: 1
example: mySlideshow.borderAlpha = 0.5;
borderColor
- type:uint
- default value: #ffffff
example: mySlideshow.borderColor = 0×33ffcc;
preloaderType
- type:String
- available values: “bar”, “circular”, “none”
- default value: “bar”
example: mySlideshow.preloaderType = “circular”;
barPreloaderWidth
- type:Number
- default Value: 100
example:mySlideshow.barPreloaderWidth = 200;
circularPreloaderRadius
- type:Number
- default Value: 20
example:mySlideshow.circularPreloaderRadius = 30;
preloaderFillColor
- type:uint
- default value: #ffffff
example: mySlideshow.preloaderFillColor = 0×33ff00;
preloaderLineColor
- type:uint
- default value: #ffffff
example: mySlideshow.preloaderLineColor = 0×33cc33;
preloaderFillAlpha
- type:Number
- default value: 0.5
example: mySlideshow.preloaderFillAlpha = 0.4;
preloaderLineAlpha
- type:Number
- default value: 1
example: mySlideshow.preloaderLineAlpha = 0.8;
setTextPreloader
- type:Boolean
- default value: true
example: mySlideshow.setTextPreloader = false;
textPreloaderFont
- type:String
- default value: “Arial”
example: mySlideshow.textPreloaderFont = “Verdana”;
textPreloaderSize
- type:Number
- default value: 12
example: mySlideshow.textPreloaderSize = 10;
textPreloaderColor
- type:uint
- default value: #ffffff
example: mySlideshow.textPreloaderColor = 0×33ff00;
textPreloaderBold
- type:Boolean
- default value: false
example: mySlideshow.textPreloaderBold = true;
transitionEffect
- type:String
- available values: “random”, “fade”, “blur”, “brightness”, “noise”, “pixel dissolve”, “threshold”, “pixelate”, “squares”, “explode”, “fly”, “none”
- default value: “random”
example: mySlideshow.transitionEffect = “brightness”;
transitionSpeed
- type:Number
- this propertie represents the speed of the transition in frames and the way this propertie influences the transition depends also on the transition effect (a lower value for the transitionSpeed means a higher speed and vice versa)
- default value: 30
example: mySlideshow.transitionSpeed = 10;
The next properties are available only for some effects.
horizontalSquares
- type:int
- available for “squares” and “explode” effects
- default value: 10
example: mySlideshow.horizontalSquares = 20;
verticalSquares
- type:int
- available for “squares” and “explode” effects
- default value: 10
example: mySlideshow.horizontalSquares = 14;
squaresEffectType
- type:String
- available for “squares” effect
- available values: “scale”, “height”, “width”, “alpha”, “blur”
- default value: “scale”
example: mySlideshow.squaresEffectType = “blur”;
squaresDirection
- type:String
- available for “squares” effect
- available values: “top-bottom”, “bottom-top”, “right-left”, “left-right”, “TL-BR”, “TR-BL”, “BL-TR”, “BR-TL”, “margin-center H”, “center-margin H”, “margin-center V”, “center-margin V”, “jump one T-B”, “jump one B-T”, “jump one L-R”, “jump one R-L”, “jump one V”, “jump one H”, “spiral M1″, “spiral M2″, “spiral C1″, “spiral C2″, “random”
- default value: “top-bottom”
example: mySlideshow.squaresDirection = “margin-center V”;
squaresSpeed
- type:Number
- available for “squares” effect
- represents the speed(in seconds) at which the square grows
- default value: 1
example: mySlideshow.squaresSpeed = 0.5;
squaresAAT
- type:Number
- available for “squares” effect
- represents the number of squares that are animated at a time
- default value: 2
example: mySlideshow.squaresAAT = 5;
registrationPoint
- type:String
- available for “squares” and “fly” effect
- available values: “center”, “center-right”, “center-left”, “top-right”, “top-center”, “top-left”, “bottom-right”, “bottom-center”, “bottom-left”
- default value: “center”
example: mySlideshow.registrationPoint = “top-right”;
easingType
- type:String
- available for “squares” and “fly” effect
- available values: “Back”, “Bounce”, “Circular”, “Cubic”, “Elastic”, “Exponential”, “Linear”, “Quadratic”, “Quartic”, “Quintic”, “Sine”
- default value: “Exponential”
example: mySlideshow.easingType = “Quadratic”;
easingMethod
- type:String
- available for “squares” and “fly” effect
- available values: “easeIn”, “easeOut”, “easeInOut”, “easeOutIn”
- default value: “easeOut”
example: mySlideshow.easingMethod = “easeInOut”;
flyDirection
- type:String
- available for “fly” effect
- available values: “top-bottom”, “bottom-top”, “left-right”, “right-left”, “zoom”
- default value: “top-bottom”
example: mySlideshow.flyDirection = “zoom”;
pixelSize
- type:Number
- available for “pixelate” effect
- represents the maximum pixel size for the transition
- default value: 100
example: mySlideshow.pixelSize = 50;
Working with XML
Use the “path” attribute to tell the slideshow the path to the image.
example:
-
<images>
-
<img path="images/image0.jpg" />
-
<img path="images/image1.jpg" />
-
<img path="images/image2.jpg" />
-
<img path="images/image3.jpg" />
-
<img path="images/image4.jpg" />
-
<img path="images/image5.jpg" />
-
<img path="images/image6.jpg" />
-
<img path="images/image7.jpg" />
-
<img path="images/image8.jpg" />
-
<img path="images/image9.jpg" />
-
</images>
Other attributes: effect, squaresDirection, verticalSquares, horizontalSquares, squaresAAT, squaresSpeed, registrationPoint, squaresEffectType, pixelSize, transitionSpeed, flyDirection, easingType, easingMethod, urlPath, urlWindow
example:
-
<images>
-
<img path="images/image0.jpg" effect="fade" transitionSpeed="20" />
-
<img path="images/image1.jpg" effect="fly" flyDirection="left-right" easingType="Elastic" easingMethod="easeOut" />
-
<img path="images/image2.jpg" effect="pixelate" pixelSize="50" />
-
<img path="images/image3.jpg" effect="brightness" urlPath="http://flashotaku.com" ulrWindow="_blank" />
-
<img path="images/image4.jpg" effect="pixel dissolve" />
-
<img path="images/image5.jpg" effect="threshold" />
-
<img path="images/image6.jpg" effect="explode" horizontalSquares="30" verticalSquares="20" />
-
<img path="images/image7.jpg" effect="squares" squaresEffectType="blur" squaresDirection="random" squaresAAT="2" squaresSpeed="1" horizontalSquares="20" verticalSquares="14" transitionSpeed="20" />
-
<img path="images/image8.jpg" effect="noise" transitionSpeed="10" />
-
<img path="images/image9.jpg" effect="squares" squaresEffectType="scale" squaresDirection="spiral M1" squaresAAT="2" squaresSpeed="2" horizontalSquares="15" verticalSquares="7" transitionSpeed="30" />
-
</images>
Woking with events
TRANSITION_START
- dispatched when the transition starts
TRANSITION_COMPLETE
- dispatched when the transition is complete
XML_OPEN
- dispatched when the loading of the XML file starts
XML_PROGRESS
- dispatched when the XML file is loading
XML_COMPLETE
- dispatched when the loading of the XML file is complete
SLIDE_OPEN
- dispatched when the loading of a slide starts
SLIDE_PROGRESS
- dispatched when a slide is loading
SLIDE_INIT
- dispatched when the properties of a slide are available
SLIDE_COMPLETE
- dispatched when the loading of a slide is complete
CLICK
- dispatched when the user is clicking on a slide
ROLL_OVER
- dispatched when the user moves the mouse over a slide
ROLL_OUT
- dispatched when the user moves the mouse away from a slide
MOUSE_UP
- dispatched when the user releases the mouse over a slide
MOUSE_DOWN
- dispatched when the user presses the mouse over a slide
MOUSE_OVER
- dispatched when the user moves the mouse over a slide
MOUSE_OUT
- dispatched when the user moves the mouse away from the slide
example:
-
import com.flashotaku.slideshow.events.SlideshowEvent;
-
-
mySlideshow.addEventListener(SlideshowEvent.SLIDE_PROGRESS, slideProgressHandler);
-
mySlideshow.addEventListener(SlideshowEvent.TRANSITION_START, transitionStartHandler);
-
mySlideshow.addEventListener(SlideshowEvent.MOUSE_OVER, mouseOverHandler);
-
-
function slideProgressHandler(event:SlideshowEvent){
-
trace(event.slide.bytesLoaded, event.slide.bytesTotal);
-
}
-
-
function transitionStartHandler(event:SlideshowEvent){
-
trace("transition is starting");
-
}
-
-
function mouseOverHandler(event:SlideshowEvent){
-
trace(event.slide.id);
-
}
Support
As of 11 March 2009, support is no longer provided for the free components. If you need support, please purchase the commercial version of the components.
March 13th, 2008 at 3:46 am
Does this component need any actionscript on the timeline?
Or is it just supposed to work by dragging it on to the stage and configuring the XML path?
Please provide a little more direction on how to use the component.
Thanks.
March 13th, 2008 at 9:53 am
The component is not supposed to play automatically. You need to use some methods to load the next or the previous image.
mySlideshow.nextImage() - goes to the next image
mySlideshow.prevImage() - goes to the previous image
March 17th, 2008 at 4:15 pm
Hi, thanks for this component, the transitions are great!
I especially like the variety of box configurations.
I have only one suggestion:
When I set “maintain aspect ratio”, the previous slide changes size before the transition starts - maybe you can tween the size? It looks a little jumpy with that setting.
Also what license is this released under? Any chance you would like to go open source?
Thanks!
March 17th, 2008 at 5:20 pm
Hi,
Thank you for the suggestion
The components I’ve developed so far are free to use in any kind of projects but I don’t think I will release the source code. However, I will release a paid version of these components which will have new features and improvements and this version will be available to be purchased under a few licenses, including a source code license.
March 18th, 2008 at 9:21 pm
Hi,
really nice work, i was wondering where i can get com.flashotaku AS3 package so i can use it in my projects.
thx
March 19th, 2008 at 12:19 pm
the source code is not available…only the compiled components
March 27th, 2008 at 2:30 pm
Hi,
I’ve been playing with your slideshow, very nice.
In the action frame you quoted
“//if your slideshow has 20 images, the id of the last image is 19″
But after image 10, ie id 9 (starting from 0) the count goes back to 0, (1)0 not 10.
Any ideas?
thx
March 27th, 2008 at 4:27 pm
Hi,
That’s because the slideshow from that example only has 10 images.
April 3rd, 2008 at 10:59 pm
I am trying to get just images for slideshow and I set the timing….no buttons, no borders. Any suggestions?
Thanks,
K
April 4th, 2008 at 8:32 am
Hi Ken,
I’ve answered you here.
April 14th, 2008 at 8:05 am
Hi , i’m try to do this
curchild=galleryXML.album[idcurrent].images[0];
myFlashslide.xmlPath=curchild;
the error is ERROR:The path of the xml file is not correct.
there is a metod to do something like this
tanks
April 14th, 2008 at 1:38 pm
Hi,
The xmlPath property requires a string, the path to the XML file.
April 14th, 2008 at 9:49 pm
Hi,
Is there a property within your package that allows me to get the number of images?
something like -
var myslideshow_images:Number = myslideshow.countSlides():
cheers
Matt
April 14th, 2008 at 10:26 pm
Hi Matt,
There is no property to return the total number of images.
You can get that number only if you parse the XML file again.
April 15th, 2008 at 9:50 pm
ok i know this but what is the propriety to bind a xml object to slides show , i explain me better , i load the xml using xmlpath after i parse this , but how can bind a xml object
April 15th, 2008 at 10:18 pm
fabrizio,
You can’t use an XML object. With this component you can only use an XML file.
June 10th, 2008 at 11:15 am
i need to click a button to change the xml
i have more than one section
every section has different xml
i need to change the xml by a menu
i have the menu
June 10th, 2008 at 1:20 pm
To change the XML use the xmlPath property.
mySlideshow.xmlPath = “images2.xml”
June 11th, 2008 at 1:31 pm
i am trying to change xml file when i click a button so the images are changed with different buttons like this:
function loadMovie1(){
mySlideshow.xmlPath = “images22.xml”;
addChild(mySlideshow)
}
it gives me paramter url cant be non-null
June 11th, 2008 at 1:39 pm
i cant define the xml path inside anyfunction… :(
June 11th, 2008 at 8:54 pm
That can’t be…You must be doing something wrong somewhere in your code. Post a bigger portion of your code or send me the file and I’ll check it.
June 12th, 2008 at 1:16 pm
i wanted to do an interface with 6 or 7 buttons so i can click an item of them so a slideshow is loaded but with different xml file according to the item clicked, but now i failed to do it, so i am using ur auto slideshow with next and back buttons and i made my items calls loadImages()
…it working good ..but thank u really for this nice component
June 23rd, 2008 at 7:47 pm
I just want to add a Next and previous button.
what is the correct script syntax for this?
Thanks
June 24th, 2008 at 10:57 am
mySlideshow.nextImage() - goes to the next image
mySlideshow.prevImage() - goes to the previous image
let’s say you have 2 buttons, ‘prev’ and ‘next’. You need to add this code:
import flash.events.MouseEvent;next.addEventListener(MouseEvent.CLICK, nextHandler);
prev.addEventListener(MouseEvent.CLICK, prevHandler);
function nextHandler(event:MouseEvent)
{
mySlideshow.nextLeft();
}
function prevHandler(event:MouseEvent)
{
mySlideshow.prevRight();
}
June 30th, 2008 at 11:15 am
i just want to say thank you for the work you do here - you give someone like me, who has absolutely no clue about flash/actionscript, the chance to spice up a site’s gallery with these awesome works of yours.
you are a god!
June 30th, 2008 at 12:19 pm
I’m very glad to hear this. :)
July 25th, 2008 at 9:53 am
How would I load the components when a button is clicked from a class file? There is nothing on my stage just the movieclips which I call from this class file and the you (awesome)components.
Can this be done?
thanx
July 25th, 2008 at 10:25 am
nevermind, just a little bit of further searching gave me the answer I was looking for. (smacking myself agaist the head)
July 25th, 2008 at 11:58 am
OK, glad you you’ve worked it out. :)
August 19th, 2008 at 10:24 pm
heya sorry still having issues.iam new to as3 and its more difficult than i thought….i have downloaded the component and dropped on its on layer i have 2 buttons that are seperate that have instance names of next and prev i also have the three other video files which iam working fine on a as layer which this is the code stop();
import caurina.transitions.*;
buttp.addEventListener(MouseEvent.ROLL_OVER, buttp_ROLLOVER);
function buttp_ROLLOVER(e:MouseEvent):void
{
Tweener . addTween (prima, {_frame : 17 , time :0.3 , transition :”linear” });
var over:Over = new Over();
over.play();
}
buttp.addEventListener(MouseEvent.ROLL_OUT, buttp_ROLLOUT);
function buttp_ROLLOUT(e:MouseEvent):void
{
Tweener . addTween (prima, {_frame : 0 , time :0.5 , transition :”linear” });
}
import caurina.transitions.*;
buttf.addEventListener(MouseEvent.ROLL_OVER, buttf_ROLLOVER);
function buttf_ROLLOVER(e:MouseEvent):void
{
Tweener . addTween (floren, {_frame : 17 , time :0.3 , transition :”linear” });
var over:Over = new Over();
over.play();
}
buttf.addEventListener(MouseEvent.ROLL_OUT, buttf_ROLLOUT);
function buttf_ROLLOUT(e:MouseEvent):void
{
Tweener . addTween (floren, {_frame : 0 , time :0.5 , transition :”linear” });
}
import caurina.transitions.*;
butts.addEventListener(MouseEvent.ROLL_OVER, butts_ROLLOVER);
function butts_ROLLOVER(e:MouseEvent):void
{
Tweener . addTween (saph, {_frame : 17 , time :0.3 , transition :”linear” });
var over:Over = new Over();
over.play();
}
butts.addEventListener(MouseEvent.ROLL_OUT, butts_ROLLOUT);
function butts_ROLLOUT(e:MouseEvent):void
{
Tweener . addTween (saph, {_frame : 0 , time :0.5 , transition :”linear” });
}
do i add the code for the gallery on the same as layer ?
also i have the myslideshow folder in the same root directory as the fla file and caurina package,is this the right place?….sorry for my ignorance but iam finding it very difficult
August 19th, 2008 at 10:35 pm
when iam trying to imort the xml its activating the other three video files to start automatically….arrr pulls hair out
August 20th, 2008 at 11:16 am
After you’ve dragged the component on the stage,give it the instance name of “mySlideshow”. Then click on it and open the Component Inspector to see all the available properties. Go to the xmlPath property and write the path to your XML file in which you have all the paths to the images.
The code you need to add for the navigation is this:
next.addEventListener(MouseEvent.CLICK, nextClickHandler);
prev.addEventListener(MouseEvent.CLICK, prevClickHandler);
function nextClickHandler(event:MouseEvent)
{
mySlideshow.nextImage();
}
function prevClickHandler(event:MouseEvent)
{
mySlideshow.prevImage();
}
August 20th, 2008 at 11:22 am
thanks your an absoulute legend i appreciate that alot
August 20th, 2008 at 1:09 pm
hmm i must be close…this is how i have the code in the as layer
import caurina.transitions.*;
buttp.addEventListener(MouseEvent.ROLL_OVER, buttp_ROLLOVER);
function buttp_ROLLOVER(e:MouseEvent):void
{
Tweener . addTween (prima, {_frame : 17 , time :0.3 , transition :”linear” });
var over:Over = new Over();
over.play();
}
buttp.addEventListener(MouseEvent.ROLL_OUT, buttp_ROLLOUT);
function buttp_ROLLOUT(e:MouseEvent):void
{
Tweener . addTween (prima, {_frame : 0 , time :0.5 , transition :”linear” });
}
import caurina.transitions.*;
buttf.addEventListener(MouseEvent.ROLL_OVER, buttf_ROLLOVER);
function buttf_ROLLOVER(e:MouseEvent):void
{
Tweener . addTween (floren, {_frame : 17 , time :0.3 , transition :”linear” });
var over:Over = new Over();
over.play();
}
buttf.addEventListener(MouseEvent.ROLL_OUT, buttf_ROLLOUT);
function buttf_ROLLOUT(e:MouseEvent):void
{
Tweener . addTween (floren, {_frame : 0 , time :0.5 , transition :”linear” });
}
import caurina.transitions.*;
butts.addEventListener(MouseEvent.ROLL_OVER, butts_ROLLOVER);
function butts_ROLLOVER(e:MouseEvent):void
{
Tweener . addTween (saph, {_frame : 17 , time :0.3 , transition :”linear” });
var over:Over = new Over();
over.play();
}
butts.addEventListener(MouseEvent.ROLL_OUT, butts_ROLLOUT);
function butts_ROLLOUT(e:MouseEvent):void
{
Tweener . addTween (saph, {_frame : 0 , time :0.5 , transition :”linear” });
}
next.addEventListener(MouseEvent.CLICK, nextClickHandler);
prev.addEventListener(MouseEvent.CLICK, prevClickHandler);
function nextClickHandler(event:MouseEvent)
{
mySlideshow.nextImage();
}
function prevClickHandler(event:MouseEvent)
{
mySlideshow.prevImage();
}
i folowed your instructions..dag and dropped the componet to the stage,then gave it an instance name of mySlideshow…i have the xml file named images,and the images folder in the same directory as the swf and fla file so in the component inspector i wrote the path as mySlideshow.xmlPath = “images.xml”;…..but when i test movie i get this error ERROR:The path of the xml file is not correct……any idea what iam doing wrong,,i must be close
August 20th, 2008 at 1:33 pm
Make sure the XML file is in the same directory with the SWF file.
August 20th, 2008 at 3:53 pm
hm well thats the problem,it is in the same folder,thats why i cant work out the problem
August 20th, 2008 at 6:06 pm
Hello! Thanks for this awesome component! It saved me hours of work! I just have a doubt… I can’t import SlideShowEvent… how is that supposed to work? If we don’t have the package with the classes?
Thank you very much again, for your work and attention.
August 20th, 2008 at 9:27 pm
The name of the class is SlideshowEvent.
import com.flashotaku.slideshow.events.SlideshowEvent should work.
You don’t really need the classes, the SlideshowEvent class will be imported from the SWC file.
August 22nd, 2008 at 2:00 am
hi, i tried using ur slideshow in a wordpress website of mine and no image is showing up, maybe there’s something wrong with the path? what u think?
i used the default path in the xml file i just changed the image filenames
August 22nd, 2008 at 10:19 am
Hi,
Use absolute paths.
<images path=”http://www.mydomain.com/images/myImage.jpg”/>
Also when you give the slideshow the path to the XML file, that should be something like:
http://www.mydomain.com/images.xml
August 30th, 2008 at 1:20 pm
Exellent component Otaku.
Works like a charm.
October 1st, 2008 at 6:40 pm
Hello
I’ve set the border and it shows up but there are gaps between the actual image and the line of the border along the top and the right side. Is there a way to control that?
Thanks for our help,
Paul
October 1st, 2008 at 9:18 pm
Hi,
Use integer values for the component’s x, y, width and height.
October 23rd, 2008 at 6:20 pm
Is there a way to trigger a specified through a URI value in a link using the loadImage(i:int) function?
This is truly a great expansive comp.
c.
October 24th, 2008 at 2:24 pm
Hi,
The URLs can only be specified in the XML file. The loadImage() method only loads an image at a specific index in the XML file.
October 24th, 2008 at 5:18 pm
Cool I wasnt sure. Thought it would be cool to pass variable in to the movie from js triggered in a text link or something. I may just load it in the div that holds the flash as a static image.
Thanks for the reply though.
c.
December 6th, 2008 at 11:35 am
Hi,
When I have images which width is different, the component scales currently displayed image to fit its width to the width of the next image - just before transition. Well, it don’t look nice… Any way to fix it?
Best,
December 6th, 2008 at 3:55 pm
Hi there,
Unfortunately, there is no way to fix that. If the previous slide wouldn’t scale, it would look bad especially if the new slide has smaller width or height and other approaches have disadvantages too.
Cheers
March 11th, 2009 at 12:57 pm
[...] Documentation for this component is available here. [...]
April 14th, 2009 at 7:20 am
Hi I have a problem when using the thumb slider and slide show component together in Gaia
1046: Type was not found or was not a compile-time constant: ThumbnailEvent.
1046: Type was not found or was not a compile-time constant: SlideshowEvent.
And i have these at the start
import com.flashotaku.thumbnailscroller.events.ThumbnailEvent;
import caurina.transitions.Tweener;
import com.flashotaku.slideshow.events.SlideshowEvent;
April 14th, 2009 at 7:21 am
Ps Thanks for making the time to create these components it works on one of my pages just not the others
April 15th, 2009 at 3:06 pm
Hi,
I haven’t worked with Gaia framework before but the components should work if everything is setup correctly.
October 6th, 2009 at 8:59 pm
Hi Otaku,
I saw in documentation that there is a Click event (dispatched when the user is clicking on a slide) so I was wondering if it is possible that when I click on the slide a bigger pictures opens in another mc so that I can have that picture on the same page as slideshow?
Btw, this component rocks, and many thanks for it.