;

PDA

Click to See Complete Forum and Search --> : presentation random slide


thephantombudgie
12-13-2006, 02:35 PM
Hi-

im using the rpesentatin feature in flash 8 to make visuals to be shown on a laptop. it should be quite easy, ive numbered each slide 1-10 and want it to jump to a random one when the mouse is clicked. it seemed simple but just won't work.

o

onClipEvent (mouseDown){
i=Math.ceil(Math.random()*10);
_parent.currentSlide.gotoSlide(i);
trace(i);
}



the trace comes up fine with the random numbers between 1 and 10 but the slide won't change.
can anyone see where im going wrong or suggest a better way to do this?

cheers

aldorr
12-13-2006, 09:33 PM
Maybe it's the "o" at the beginning. Just kidding.

Perhaps there is a more elegant way of doing this, but I've found it's easier to call things by name than to figure out where they are in the heirarchy.

Try this:

onClipEvent (mouseDown) {
i = Math.ceil (Math.random () * 10);
// you need the full name and path of the slide here
random_slide = "_root.presentation.slide" + i;
// where presentation is the name of the root slide
_parent.gotoSlide (eval(random_slide));
trace (i);
trace (random_slide);
trace (_root.presentation.currentSlide);
}

Enjoy,
aldorr