02-20-2006, 10:14 PM
|
#1
|
|
Registered User
Join Date: Feb 2006
Posts: 6
|
AS for key press
Hello all...
I am creating a presentation out of flash, and I need to set this up like a next slide type of thing, and I don't want to add a button to attach an action to tell it to go to a new swf file, wondering how I can program it so someone can sit at the computer and just hit the left and right arrow keys to advance the "slide?"
Thanks much!
|
|
|
02-20-2006, 10:23 PM
|
#2
|
|
Super Moderator
Join Date: Jul 2001
Location: NYC
Posts: 10,175
|
|
|
|
02-20-2006, 11:27 PM
|
#3
|
|
Registered User
Join Date: Feb 2006
Posts: 6
|
Thanks. I was messing around and I got this to work--
on(keyPress "<Right>"){
gotoAndPlay('underwriting');
}
But how do I make a second right arrow go to say 'test' ??
Also, how do I make it go back if I want? I know you can just do the 'left' but how does it know what frame to go back to?
Referring to your links, I am not good with AC so I don't understand the whole listener thing. Sorry for being a bone head! I just want to be able to hit the arrow key left or right to advance or go back. But I don't know how to make it know which frame to go back to. I appreciate it. Oh I am in Flash 8, so I am assuming my AC that I did use that worked is a bit outdated.
Last edited by cgustin; 02-20-2006 at 11:31 PM.
|
|
|
02-20-2006, 11:30 PM
|
#4
|
|
Super Moderator
Join Date: Jul 2001
Location: NYC
Posts: 10,175
|
you add a listener...then write an "if" statement.
|
|
|
02-21-2006, 03:44 PM
|
#5
|
|
Registered User
Join Date: Feb 2006
Posts: 6
|
I am sorry, I have never done this before so I am not sure how to go about it, can you elaborate for me? I appreciate it very much!
|
|
|
02-21-2006, 06:12 PM
|
#6
|
|
Registered User
Join Date: Feb 2006
Posts: 6
|
I saw someone else's post, so I added this to the actions
keyObj = new Object();
keyObj.onKeyDown = function() {
if(Key.getCode() == 32) { // space bar
goForward();
} else if(Key.getCode() == 39) { // right arrow
goForward();
} else if(Key.getCode() == 37) { // left arrow
goBackward();
}
};
I am getting an error of this:
**Error** Symbol=mc_contentBackgnd, layer=fake button2, frame=1:Line 1: Statement must appear within on handler
keyObj = new Object();
**Error** Symbol=mc_contentBackgnd, layer=fake button2, frame=1:Line 2: Statement must appear within on handler
keyObj.onKeyDown = function() {
Shouldn't this part of the code work???
|
|
|
02-24-2006, 04:13 PM
|
#7
|
|
Registered User
Join Date: Feb 2006
Posts: 6
|
Can anyone out there help me? I have a deadline approaching and not sure how to complete this action. Thanks so much!
|
|
|
02-24-2006, 04:58 PM
|
#8
|
|
Super Moderator
Join Date: Jul 2001
Location: NYC
Posts: 10,175
|
ActionScript Code:
var keyListener = {};
keyListener.onKeyDown = function()
{
var theKey = Key.getCode();
trace( "keyCode: " + theKey );
switch( theKey )
{
case 32 :
goForward();
break;
case 39 :
goForward();
break;
case 37 :
goBackward();
break;
}
};
Key.addListener( keyListener );
|
|
|
02-24-2006, 06:36 PM
|
#9
|
|
Registered User
Join Date: Feb 2006
Posts: 6
|
Wow that was quick. Thanks so much!
|
|
|
02-24-2006, 06:36 PM
|
#10
|
|
I'm an alright guy
Join Date: Jun 2005
Location: I live where my rump rests
Posts: 292
|
this probably deserves its own thread...
I'm working with Flash Lite 1.0 and im trying to access a key event from a phone or PDA, it seems that Flash Lite is a form of Flash 4. When I try using listeners it comes up with errors. Has anyone here dealt with this before? any info or point in the right direction would be appreciated.
|
|
|
| Thread Tools |
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT. The time now is 01:09 AM.
///
|
|