I’m fairly new to actionscript but I’ve created a flash presentation and it works great however I need to modify it slightly.
As default if you press the right arrow it goes to the next slide and if you press the left arrow it goes to the previous slide.
I need to change this function to work on pageup and pagedown key press.
I’ve had a go at doing this myself but the function just repeats over and over and therefore when I press page up it goes rapidly flicks though all the slides until it gets to the end.
Please can someone help. Heres my code:
onClipEvent(enterFrame){
if (Key.getCode() == Key.PGDN) {
// GoTo Next Screen behavior
var screen = null;
var target = this;
while((screen == null) && (target != undefined) && (target != null))
{
if(target instanceof mx.screens.Screen)
{
screen = target;
}
else
{
target = target._parent;
}
}
if(screen instanceof mx.screens.Slide)
{
screen.rootSlide.currentSlide.gotoNextSlide();
}
// End GoTo Next Screen behavior
}
else if (Key.getCode() == Key.PGUP) {
// GoTo Last Screen behavior
var screen = null;
var target = this;
while((screen == null) && (target != undefined) && (target != null))
{
if(target instanceof mx.screens.Screen)
{
screen = target;
}
else
{
target = target._parent;
}
}
if(screen instanceof mx.screens.Slide)
{
screen.rootSlide.gotoLastSlide();
}
// End GoTo Last Screen behavior
}
}