Slide.gotoSlide()

Availability

Flash Player 6 (6.0.79.0).

Edition

Flash MX Professional 2004.

Usage

mySlide.gotoSlide(newSlide)

Parameters

newSlide The slide to navigate to.

Returns

A Boolean value indicating if the navigation succeeded (true) or not (false).

Description

Method; navigates to the slide specified by newSlide. For the navigation to succeed, the following must be true:

If either of these conditions isn't met, the navigation fails and the method returns false; otherwise, the method navigates to the specified slide and returns true.

For example, consider the following slide hierarchy:

Presentation
  Slide1
    Slide1_1
    Slide1_2
 Slide2
    Slide2_1
    Slide2_2 

If the current slide is Slide1_2, the following gotoSlide() call fails, because the current slide is not a descendant of Slide2:

Slide2.gotoSlide(Slide2_1);

Also consider the following screen hierarchy, where a form object is the parent screen of two separate slide trees:

Form_1
    Slide1
        Slide1_1
        Slide1_2
    Slide2
        Slide2_1
        Slide2_2

If the current slide is Slide1_2, the following method call also fails, because Slide1 and Slide2 are in different slide subtrees:

Slide1_2.gotoSlide(Slide2_2);

Example

The following code, attached to a Button component, uses the Slide.currentSlide property and the gotoSlide() method to display the next slide in the presentation.

on(click) {
    _parent.gotoSlide(_parent.currentSlide.nextSlide);
}

This is equivalent to the following code, which uses the Slide.gotoNextSlide() method:

on(click) {
    _parent.currentSlide.gotoNextSlide();
}

See also

Slide.currentSlide, Slide.gotoNextSlide()