Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 02-05-2006, 03:20 PM   #1
Registered User
Join Date: Feb 2006
Posts: 3
Default on <keypress> without buttons

Hi, I'm working on a presentation that I wish to advance using a keyboard button. Now I'm using the presentation format Macromedia provided, which uses slides and that's ok, but I want more timeline control within the slides.

I'm a newbie to scripting, so I tried stop(); on frame 15, then put in:

on (keyPress "<Space>") { gotoAndPlay(16);

Except it returns the error that I need to use that with a button instance. I suppose I could use an invisible button, but is there another way to control the timeline movement within a slide without having visible controls? It's going to be on a projector, so seeing buttons or mouse cursors would look ugly.
ChaoZ is offline   Reply With Quote
Old 02-05-2006, 04:27 PM   #2
New Member
Join Date: Jan 2006
Posts: 24


that should help. But don't try to work with this within the onKeyDown-Function, because it refers to the Listener Object and not to the current TimeLine.

PHP Code:
var myListener:Object = new Object();

myListener.onKeyDown = function () {
    if (
Key.isDown(SPACE)) {
//your actions here

Last edited by luke_the_duke; 02-05-2006 at 04:39 PM.
luke_the_duke is offline   Reply With Quote
Old 02-05-2006, 09:37 PM   #3
Registered User
Join Date: Feb 2006
Posts: 3

Wow, that's a lot more complicated than I thought it would be. Where exactly would I insert this code? I tried putting it right at frame 15 after a stop(); command but it didn't resume after hitting space.

Where you put the comment, I put in gotoAndPlay(16);
ChaoZ is offline   Reply With Quote
Old 02-06-2006, 12:35 AM   #4
Registered User
Join Date: Nov 2005
Posts: 53

or instead of that you could make a small button and then just put it so that it is outside of the visible range on the stage (in the grey area) and have this script on it.

ActionScript Code:
on (keypress "<Enter>") {        gotoAndPlay(16); }

or whatever keypress and frame you want
ASG is offline   Reply With Quote
Old 02-07-2006, 09:14 PM   #5
Registered User
Join Date: Feb 2006
Posts: 3

The idea suggested by the previous poster worked... for a while.

For some reason, after adding in some video clips in a different slide, it stopped functioning. I don't even know if it's the videos that caused it (I've tried switching keys to see if there's a conflict of some kind, didn't help). Here is the code I used on the button which is off to the side.

on (keyPress "m") {

Simple enough. The sequence of events is ideally as follows:

1. Movie plays
2. Movie hits stop point and stops
3. I hit a key on the keyboard
4. Flash moves one frame after the stop frame and continues playing until the next stop point.

I've placed stop(); commands on a separate layer on the timeline.

Can anybody help?
ChaoZ is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do i hide buttons and make them appear on a mouse event? DalAlarm ActionScript 2.0 1 11-15-2005 08:38 AM
Buttons that just won't leave... RQFlash ActionScript 2.0 5 07-25-2005 06:51 PM
buttons in external swf halkiede ActionScript 2.0 2 02-16-2005 03:49 AM
Loading buttons into movie clips in ordered sequence? datter ActionScript 1.0 (and below) 3 12-08-2004 06:25 PM
Scrolling through number of Buttons bjory Components 3 09-23-2004 07:57 AM

All times are GMT. The time now is 12:42 PM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.