Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I use a keyboard button instead of the mouse? 2

Status
Not open for further replies.

danielh68

Technical User
Jul 31, 2001
431
US
Hi

I haven't used Flash in awhile, so hopefully someone can help me with this problem. I use PowerPoint a lot for our company's presentations, I would like to take it to the next level in terms of multi-media and interactivity...hence, Flash 5. The thing I'm concerned about, is the sales agents who use PP only use the keyboard to advance through the presentation, such as "enter" or the arrow symbols. Anyhow, can I assign a key that instructs the page to advance in Flash? If so, how?

Thanks in advance,
DanH
 
add to frame 1 in main movie

myKeyListener = new Object();
myKeyListener.onKeyDown = function() {
if (Key.isDown(28)){
//right
}
if (Key.isDown(29)){
//left
}
if (Key.isDown(13)){
//enter
}

}
Key.addListener(myKeyListener);
stop();



 
Or in the actions dialog box you can put a check mark by "key press" and in the blank box hit the forward arrow button. Or any key command that you would want to use.
 
Thanks guys.

Bill, in your method I created two scenes (first scene: red circle, second scene: green circle), with the first frame of scene 1 I opened actions in expert mode, then I pasted the code you provided and tested the movie. When the movie is playing I see the red circle, if I push "enter" it flashes to the green circle but reverts to the red circle. As for the left and right arrows they don't do anything. Since I'm not well versed in actionscripting, perhaps I'm missing someting simple. Any suggestions?

Sle2002, with your method are you suggesting that there's a pre-made action existing in the library? Such as Actions/Movie Control/Next Scene? If so, this is all I need, however I don't see a "key press" field or icon. Am I looking in the right area?

Thanks again everyone.
Dan
 
rereading your post.....the code i posted will only work in mx not 5..sorry.
 
My apologies, I goofed, I'm in fact using MX.
 
then the code i posted will work..unles i boobed on the numbers


you paste it a frame..well frame 1 ..then add the code to control arrow clicks

add this and test in authoring

myKeyListener = new Object();
myKeyListener.onKeyDown = function() {
if (Key.isDown(28)){
trace("right");
}
if (Key.isDown(29)){
trace("left");
}
if (Key.isDown(13)){
trace("enter");
}

}
Key.addListener(myKeyListener);
stop();

 
Hi Bill,

I'm doing something wrong, I'm getting the same behavior as before. "Enter" will cause it to flash momentarily to scene two, but it doesn't stay. And the left & right arrows keys just don't function.

If this helps, I took a snapshot of my screen. Perhaps looking at it you can tell that something is obviously wrong.


thanks,
Dan
 
finally sorted it out

var myKeyListener = new Object();
myKeyListener.onKeyUp = function() {
if (Key.getCode()==39){
trace("right");
}
if (Key.getCode()==37){
trace("left");
}
if (Key.getCode()==13){
trace("enter");
}
}
Key.addListener(myKeyListener);
stop();
 
well after posting that i went back and still had problems with the enter key so if you have that problem still...

var myKeyListener = new Object();
myKeyListener.onKeyUp = function() {
switch (key.getCode()){
case 13:
trace("enter");
break;
case 37:
trace("left")
break
case 39:
trace("right")
break
}
}
Key.addListener(myKeyListener);
stop();

that all worked fine for me
 
Yes there is a pre-made setting in the actions dialog box. If you have an e-mail address, i can send you a screen capture of what i am talking about. It is much easier (at least for me) than the other fancy actionscript.

 
Hi Bill,

Thanks. Although, I must be doing something wrong. I've copied the code, inserted it in the actions window area using the first frame of scene one. Still, my results are the same. If you have any ideas, I'd still like to hear them.

Sle2002,
Yes, I would appreciate it. I definitely would like to know both ways on how to do this. My email address is danielopti@hotmail.com


Thanks everyone for all your help.
dan
 
Thanks Bill, I just emailed you at your yahoo account.
-Dan
 
Dan,
I e-mailed you that screen capture last night. Let me know if you didn't get it.
S-
 
Thanks Bill and Sle2002, for all your help. I got it now. Both methods work just fine...in fact, great!

Thank you for your patience, time and expertise.
--DanH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top