E-merald web-engineering Flash components
E-merald web-engineering Contact Site map
 
Home Components Support Purchase
Components

ActionScript Documentation

InheritanceMovieClip > MagneticSlideshow class

Methods unique to the MagneticSlideshow class

The following table lists methods of the MagneticSlideshow class.

Method Description
MagneticSlideshow.gotoSlide() Navigates to the slide with the specified index.
MagneticSlideshow.gotoNextSlide() Navigates to the next slide in the gallery.
MagneticSlideshow.gotoPreviousSlide() Navigates to the previous slide in the gallery.

Properties unique to the MagneticSlideshow class

The following table lists properties of the MagneticSlideshow class.

Property Description
MagneticSlideshow.autoPlay Specifies whether or not the slideshow should start rotating images automatically.
MagneticSlideshow.selectedIndex Read-only; the index of currently active (selected) slide.

Events unique to the MagneticSlideshow class

The following table lists events of the MagneticSlideshow class.

Event Description
MagneticSlideshow.onLoadXML Broadcast when the slideshow attempts to load an XML file.
MagneticSlideshow.onTransitionStarted Broadcast when the transition starts.
MagneticSlideshow.onTransitionFinished Broadcast when the transition ends.

MagneticSlideshow.autoPlay

Usage

my_slideshow.autoPlay

Description

Property; specifies whether the slideshow should start rotating images automatically ("true") or not ("false"). The default value is "false".

Example

The following example sets the autoPlay property to "true":

my_slideshow.autoPlay = true;


MagneticSlideshow.gotoSlide()

Usage

my_slideshow.gotoSlide(index)

Parameters

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.

Returns

Nothing.

Description

Method; navigates to the slide with the specified index.

Example

The following example demonstrates how to navigate to the slide with index 5:

my_slideshow.gotoSlide(5);


MagneticSlideshow.gotoNextSlide()

Usage

my_slideshow.gotoNextSlide()

Returns

Nothing.

Description

Method; navigates to the next slide in the gallery.

Example

The following example demonstrates how to navigate to the next slide in the gallery:

my_slideshow.gotoNextSlide();


MagneticSlideshow.gotoPreviousSlide()

Usage

my_slideshow.gotoPreviousSlide()

Returns

Nothing.

Description

Method; navigates to the previous slide in the gallery.

Example

The following example demonstrates how to navigate to the previous slide in the gallery:

my_slideshow.gotoPreviousSlide();


MagneticSlideshow.onLoadXML

Usage

listenerObject = new Object();
listenerObject.onLoadXML = function(eventObject) {
// Your code here
}
my_slideshow.addEventListener("onLoadXML", listenerObject);

Description

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.

Event object

Contains a Boolean value ("true" or "false") to indicate whether an XML file was found.

Example

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);


MagneticSlideshow.onTransitionFinished

Usage

listenerObject = new Object();
listenerObject.onTransitionFinished = function(eventObject) {
// Your code here
}
my_slideshow.addEventListener("onTransitionFinished", listenerObject);

Description

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.

Event object

Contains a Boolean value ("true") to indicate whether the transition finished.

Example

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);


MagneticSlideshow.onTransitionStarted

Usage

listenerObject = new Object();
listenerObject.onTransitionStarted = function(eventObject) {
// Your code here
}
my_slideshow.addEventListener("onTransitionStarted", listenerObject);

Description

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.

Event object

Contains a Boolean value ("true") to indicate whether the transition started.

Example

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);


MagneticSlideshow.selectedIndex

Usage

my_slideshow.selectedIndex

Description

Property (read-only); returns the index of currently active (selected) slide.

Example

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);

© E-MERALD. All rights reserved.
© Designed by Fox.net.ua.