ActionScript 2.0 Components Language Reference |
|
|
|
| Slide class > Slide.gotoSlide() | |||
Flash Player 6 (6.0.79.0).
Flash MX Professional 2004.
mySlide.gotoSlide(newSlide)
newSlide The slide to navigate to.
A Boolean value indicating if the navigation succeeded (true) or not (false).
Method; navigates to the slide specified by newSlide. For the navigation to succeed, the following must be true:
mySlide.newSlide and the current slide must share a common ancestor slide--that is, the current slide and newSlide must reside in the same slide subtree.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);
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();
}
Slide.currentSlide, Slide.gotoNextSlide()
|
|
|
|