ActionScript Documentation
| Inheritance | MovieClip > MagneticSlideshow class |
Methods unique to the MagneticSlideshow class
The following table lists methods of the MagneticSlideshow class.
Properties unique to the MagneticSlideshow class
The following table lists properties of the MagneticSlideshow class.
Events unique to the MagneticSlideshow class
The following table lists events of the MagneticSlideshow class.
my_slideshow.autoPlay
Property; specifies whether the slideshow should start rotating images automatically ("true") or not ("false"). The default value is "false".
The following example sets the autoPlay property to "true":
my_slideshow.autoPlay = true;
my_slideshow.gotoSlide(index)
index An integer indicating the index of the slide to navigate to. This is a zero-based index, so 0 retrieves the first slide, 1 retrieves the second slide, and so on.
Nothing.
Method; navigates to the slide with the specified index.
The following example demonstrates how to navigate to the slide with index 5:
my_slideshow.gotoSlide(5);
my_slideshow.gotoNextSlide()
Nothing.
Method; navigates to the next slide in the gallery.
The following example demonstrates how to navigate to the next slide in the gallery:
my_slideshow.gotoNextSlide();
my_slideshow.gotoPreviousSlide()
Nothing.
Method; navigates to the previous slide in the gallery.
The following example demonstrates how to navigate to the previous slide in the gallery:
my_slideshow.gotoPreviousSlide();
listenerObject = new Object();
listenerObject.onLoadXML = function(eventObject) {
// Your code here
}
my_slideshow.addEventListener("onLoadXML", listenerObject);
Event; broadcast when the slideshow attempts to load an XML file.
The usage example uses a dispatcher/listener event model. A slideshow instance (my_slideshow) dispatches an event (in this case, onLoadXML) and the event is handled by a function, also called a "handler", on a listener object (listenerObject) that you create. You define a method with the same name as the event on the listener object; the method is called when the event is triggered. When the event is triggered, it automatically passes an event object (eventObject) to the listener object method. The event object has properties that contain information about the event. You can use these properties to write code that handles the event. Finally, you call the EventDispatcher.addEventListener() method on the component instance that broadcasts the event to register the listener with the instance. When the instance dispatches the event, the listener is called.
Contains a Boolean value ("true" or "false") to indicate whether an XML file was found.
This example, written on a frame of the Timeline, uses the event object to set up a conditional statement that checks to see if an XML file was found and loaded.
slideshowListener = new Object();
slideshowListener.onLoadXML = function(eventObj) {
if (eventObj.data == true) {
// show success alert
} else {
// show error alert
}
}
my_slideshow.addEventListener("onLoadXML", slideshowListener);
listenerObject = new Object();
listenerObject.onTransitionFinished = function(eventObject) {
// Your code here
}
my_slideshow.addEventListener("onTransitionFinished", listenerObject);
Event; broadcast when the transition ends and the current slide changes.
The usage example uses a dispatcher/listener event model. A slideshow instance (my_slideshow) dispatches an event (in this case, onTransitionFinished) and the event is handled by a function, also called a "handler", on a listener object (listenerObject) that you create. You define a method with the same name as the event on the listener object; the method is called when the event is triggered. When the event is triggered, it automatically passes an event object (eventObject) to the listener object method. The event object has properties that contain information about the event. You can use these properties to write code that handles the event. Finally, you call the EventDispatcher.addEventListener() method on the component instance that broadcasts the event to register the listener with the instance. When the instance dispatches the event, the listener is called.
Contains a Boolean value ("true") to indicate whether the transition finished.
This example uses the event object to display the index of currently active (selected) slide each time the transition ends.
slideshowListener = new Object();
slideshowListener.onTransitionFinished = function(eventObj) {
trace("The index of the selected slide is " + eventObj.target.selectedIndex + ".");
}
my_slideshow.addEventListener("onTransitionFinished", slideshowListener);
listenerObject = new Object();
listenerObject.onTransitionStarted = function(eventObject) {
// Your code here
}
my_slideshow.addEventListener("onTransitionStarted", listenerObject);
Event; broadcast when the transition starts.
The usage example uses a dispatcher/listener event model. A slideshow instance (my_slideshow) dispatches an event (in this case, onTransitionStarted) and the event is handled by a function, also called a "handler", on a listener object (listenerObject) that you create. You define a method with the same name as the event on the listener object; the method is called when the event is triggered. When the event is triggered, it automatically passes an event object (eventObject) to the listener object method. The event object has properties that contain information about the event. You can use these properties to write code that handles the event. Finally, you call the EventDispatcher.addEventListener() method on the component instance that broadcasts the event to register the listener with the instance. When the instance dispatches the event, the listener is called.
Contains a Boolean value ("true") to indicate whether the transition started.
This example uses the event object to send a message in the Output panel with the statement that the transition was started.
slideshowListener = new Object();
slideshowListener.onTransitionStarted = function(eventObj) {
trace("The transition is started.");
}
my_slideshow.addEventListener("onTransitionStarted", slideshowListener);
my_slideshow.selectedIndex
Property (read-only); returns the index of currently active (selected) slide.
The following example determines whether the index of currently active (selected) slide is 5, and if so, sends a message in the Output panel
slideshowListener = new Object();
slideshowListener.onTransitionFinished = function(eventObj) {
if (eventObj.target.selectedIndex == 5) {
trace("The index of currently active slide is 5.");
}
}
my_slideshow.addEventListener("onTransitionFinished", slideshowListener);
|