Link to home
Start Free TrialLog in
Avatar of Andy Brown
Andy BrownFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Using the page-up and page-down key functions to move scenes

I am extremely rusty when it comes to Flash CS3 (I'm using AS2).  I have several scenes, each one with a next/previous button.  I would really like to be able to set the Page-up and Page-down keys, to do what the buttons do when they are clicked.

Hope that makes sense.
Avatar of moagrius
moagrius
Flag of United States of America image

you can use the attached snippet as a starting point.  note that it won't work in "Test Movie" mode since Page Up and Page Down have API instructions - preview in HTML to enable visible functionality.

the code should go in the action's panel of frame 1 of the main timeline
var listenerObject:Object = {
	onKeyDown : function(){
		switch(Key.getCode){
			// page up
			case 33 : 
			  trace("page up pressed");
			  gotoAndPlay("someScene");
			  break;
			// page down
			case 34 : 
			  trace("page down pressed");
			  gotoAndPlay("anotherScene");
			  break;
		}
	}
};
Key.addListener(listenerObject);

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of moagrius
moagrius
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Andy Brown

ASKER

That's great i'll give it a try in the morning.

Thanks for your help.
Perfect - that sent me nicely on my way.

All the best.