FORUMS: list search recent posts

keyboard presentation navigation

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Enrique Orozco
keyboard presentation navigation
on Jul 13, 2008 at 8:33:28 pm

Just made a Powerpoint style presentation in Flash ... I need to have the same keyboard functionality (advance page with "enter" or any key..) that PPoint offers ... is there a simple way to do this in Flash ??? product will be an executable projector.

Any advice would be gratly apreciated

Return to posts index

Alvaro Castaneda
Re: keyboard presentation navigation
on Jul 13, 2008 at 9:14:01 pm

yeah is easy

the question is? are you using AS2 or AS3

in actionscript 2 is actually very very easy

add an off screen button and add this code to it

on(KeyPress "ENTER")

the AS3 code would be added to the first frame

stage.addEventListener(KeyboardEvent.KEY_UP, goNextFrame);

function goNextFrame(event:KeyboardEvent):void
if (event.keyCode == Keyboard.ENTER)

add a stop(); to each frame

a code tag could be very useful, if it has code highlighting and line numbers, that will be awesome!!, I've seen some around.

good luck

varomix - pixelEater

Return to posts index

Enrique Orozco
Re: keyboard presentation navigation
on Jul 14, 2008 at 2:15:28 pm

thank you Alvaro. I think you missed the < > symbols for the enter key .... it works, but sometimes (don´t know why...) when playing the swf obtained the enter key doesn´t seem to respond (have to hit it more that one time...) working with flash 8 (AS2) and putting the off screen button on a layer all the way to the timeline....


Return to posts index

Pieter Helsen
Re: keyboard presentation navigation
on Jul 13, 2008 at 9:17:59 pm

Depends on whether you're working on the main timeline, or with movieclips or whatever.

Best way to do this is using frame labels (click a specific frame and in the Properties panel you should be able to label the frame).
Once you've labeled all the frames you're using, put the names in an array, like this:

var pp_array:Array = new Array("myFirstLabel", "mySecondLabel", "andSoOn");

Then, you're gonna run through these frame labels, like so (this is Actionscript 2 code btw, AS3 is slightly different:

_global.pp_array = new Array("myFirstLabel", "mySecondLabel", "myThirdLabel", "andSoOn");

var keyListener:Object = new Object();
keyListener.onKeyDown = function(){
// The switch statement is similar to an IF-ELSE statement
// if the code returned by Key.getCode is equal to the
// Left key, the previous frame label will be used
// The right key and any other key (default) will result
// in going to the next frame
switch (Key.getCode()) {
case Key.LEFT:
case Key.RIGHT:

function nextNote(){
trace(pp_array[0]); // Just so you can see it works

// This takes the first element in the array
var append:Object = pp_array.shift();
// And attaches it to the back of the array again

function prevNote(){
// Once you press the key to the right, the first element
// Is added to the back of the array so you need the
// Second element from the right, hence length - 2
trace(pp_array[pp_array.length - 2]);
_root.gotoAndPlay(pp_array.length - 2]);

// Takes the last element in the array
var append:Object = pp_array.pop();
// And attaches it to the front of the array

Kind regards,

Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 All Rights Reserved