Please Help--Using Keyboard Input To Navigate Through Timeline
I am making a "You Don't Know Jack" type game. My problem is this...
I want to use keyboard input to let a player buzz in, like the z and / buttons. In my movie I have it stop on a certain frame while the players read the question. Then when they buzz in with their key, I want it to goto another frame.
I have tried an invisible button with the on keypress option, but it seems it doesn't detect but about 30% of the presses. I have also tried putting it in a MC and using onClipEvent(enterframe) and detecting keypresses that way, but I do not know how to tell the main timeline to go to a certain frame from inside the MovieClip.
So I guess I want to know this. How do I get a smooth keypress detector on the main timeline that will trigger some variable changes and send me to another frame, OR how do I control the maintimeline navigation from within a movie clip? (Actually both answers would be helpful).
Thanks
Darren
FlashKit > Flash Help > Flash ActionScript
Posted on: 06-20-2001, 03:02 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Using Keyboard To Navigate Help
hey
im making a cdrom for a zoo and i have a page where the user should be able to press a letter and they get taken to a scene where a movieclip is played. for example pressing 'e' will show an elephant opening its mouth and making a noise. so far i have set it up so each animal movieclip is in a sepearte scene. then in the first scene i have a button, for the elephant, with the following actionscript:
on (release, keyPress "e") {
gotoAndStop("elephant", 1);
}
this works fine however should the user choose another letter they get taken to the relevent scene ok but the sound of the elephant plays as well?!?! no matter what key is pressed the elephant sound always plays for some reason. do i need more script than just keypress"" ??
any help would be greatly appreciated. thanks, james
Keyboard Navigate
Hello. I need some ideas to start a small project. I have 5-6 buttons in menu bar. How move throught buttons with keyboard only. I prefer arrow keys and Enter key to start the action for that button (ex: move next page, next scene). I don't know how to start?Some ideas?
Navigate An External MC Timeline
hi everyone,
ok here's my situation. i have a main movie that has several empty MC's in it. when certain buttons are clicked, the empty MC's gwt swapped with swf's. so far everything has been working great.
now i have created a swf that is images on frames (photo gallery). i call this swf into the main movie, but i don't know how to navigate through the timeline. i labeled the frames in the photo gallery swf to make it easier to navigate.
this is what i have tried using:
on(release){
_root.introMC.loadMovie("mastalerz/mastalerz.swf",);
}
"introMC" is the empty MC in the main movie
"mastalerz.swf" is the swf that i am trying to navigate the timeline. how do i get to a named frame?
any help would be greatly appreciated
Using Cuepoints To Navigate Timeline
Hello,
I have a movie with several navigational cuepoints embedded. When the movie gets to these cuepoints, I want to navigate to other frames in the timeline (the movie has its own layer and has a single keyframe for the whole timeline, but other parts of the stage have things happening on different keyframes). Below is my code, where my cuepoints are named 5.1 and 5.2 the instance name for my FLVplayback is vid. Any suggestions? Thanks!
Attach Code
var vidlist:Object = new Object();
vidlist.cuepoint = function(cues) {
if(cues.info.name == "5.1") {
gotoAndPlay(3)
}
if(cues.info.name == "5.2") {
gotoAndPlay(5)
}
}
vid.addEventListener("cuepoint", vidList);
Button To Navigate Timeline
I am using Flash CS3 making use of AS3.
I have 10 buttons, every button will play the next 10 frames on the current timeline then "jump" to its intended frame which is also in a different scene. The goal is to have the beginning of every scene a basic template so that no matter where you jump from everything is consistent.
While I have learned quite a bit in the last 2 weeks, this is my second Flash Document ever (my first was done a couple weeks ago and had no AS to worry about). I have no problem reading or researching as long as I can find the material to do so, so a point in the right direction would be great.
Here is a link to what I have so far (note: this only has one button until I learn how to build the button properly, then I will be able to finish the presentation):
http://www.celestial-advocates.com/images/bosses/Akil'zon4.swf
Oh hey... my next hurdle will be to learn how to make a button to display my presentation in fullscreen format... but all things in time :)
Edited: 12/27/2007 at 10:32:52 PM by Didighagan
[CS3] Navigate Timeline Using Form Elements
Hey,
I'm trying to use form components like radio buttons and check boxes to navigate through the timeline. This is provided for in the Script Assist so I guess it must be ok.
I find in Actionscript 2 I can set actions to them: goto and stop (for example) which is exactly what I want.
When I test the movie though, i see that clicking just brings up the weird spectral image of a button behind the radio button with different radio buttons underneath, looks like a weird glitch.
Is it simple enough to use Form elements to navigate the timeline like this? What am I doing wrong?
Thanks for any help!
Input Text To Navigate A Gallery?
hello,
I am working on a gallery that is functioning greatly. Right now, the only way to navigate is to click next or previous. The images load dynamically from a XML file, and they all have a corresponding number.
For easier navigation, I would like to add an Input Text for people to enter the image number they wish to see:
Go to image # ____ GO
Then they would click GO or just press enter.
A little bit like when you browse search engine and you can to to page X, or stock photo websites. However I am not sure I can achieve it in an efficient way.
Could anybody shed some light on how to use the typed number as a value, so it leads the user to that image number?
The only solution I seem to think of is:
if (input text = 9)
go to image 9
But it would mean I have to create an IF statement for each picture!
I have never worked with input text before. A better solution would be much appreciate.
Thanks
Navigate Back To Root Timeline From Nested Mc
Total Newbie I am. I've been having some problems coding what I think would be a simple task. I have an mc nested within another mc and I would like to attach an event to a button click so that when triggered, the root timeline plays from a specific frame #.
When the btnContact is clicked I get an error that Scene 1 cannot be found. Somehow I think I need to add a var? I don't know.
Here is the script inside the nested mc:
stop();
import flash.display.Scene;
import flash.display.*;
import flash.events.*;
btnContact.addEventListener(MouseEvent.CLICK, onContactClick);
function onContactClick(event:MouseEvent):void
{
gotoAndPlay(3, "1");
}
And FYI here is my root frame 1 action script:
cat_mc.addEventListener(MouseEvent.MOUSE_OVER, onMouse_Over);
function onMouse_Over(event:MouseEvent):void
{
cat_mc.play();
}
cat_mc.addEventListener(MouseEvent.MOUSE_OUT, onMouse_Out);
function onMouse_Out(event:MouseEvent):void
{
cat_mc.stop();
}
cat_mc.addEventListener(MouseEvent.CLICK, onClick);
function onClick(event:MouseEvent):void
{
pictureframe_mc.play();
menu_mc.play();
cateyes_mc.play();
}
cat_mc.buttonMode = true
Navigate Back To Root Timeline From Loaded Swf
Okay I have two swfs (intro.swf & animation.swf).
into.swf loads animation.swf on frame 2. Once animation.swf is finished playing I am trying to go to frame 3 of intro.swf.
I have tried the following code on the last frame of aniimation.swf as follows: MovieClip(root).gotoAndPlay("3");
This does not seem to work. Help!
Forcing Keyboard Input To TextFieldType.INPUT
Hi there.
I'm trying to find out how you can force the keyboard input into the text field.
I've created an TextFieldType.INPUT field, but by default the user has to click it to activate it. Is there any way to activate it, without having to force the user to click the TextFieldType.INPUT field?
Any bright ideas?
Keyboard Input
I am having problems trying to encorporate a submit button on a website that I am working on.
I would like the user to be able to press return to submit the request as can be done from a normal html page,
I have tried using the following script but nothing happends, is there a special case for the return key?
if (Key.isDown(Key.ENTER)) {
getURL ("../search/results.asp", "", "POST");
}
Here is the url for the test page
http://www.nichols-foods.co.uk/pages/homeat.html
any ideas??
Keyboard Input
I have a crossword that I want to limit the key presses to just letters. So if they press anything that isnt a letter it wouldnt do anything. Does anyone know how to do something like this in AS2.0? Thanks
Keyboard Input In AS3
Is there a way to know when the printscreen key is pressed? I want to black out images when it is hit but it does not have a charCode. Any ideas?
-Kris
Timeline Keyboard Shortcut
Hi,
I've been searching the documentation but I can't find anything on this: a way to quickly navigate the timeline, especialy move to the beginning and end using keyboard shortcuts.
The only thing I've found is to use ctrl+0 to go to the end but that doesn't work.
Hope someone can help, regards, Danielle.
Controlling Timeline With Keyboard
I need some help. I am currently designing a game and would like to Pause the entire game when the "P" key is hit and to quit the game when the "Q" button is hit. The code I currently have is as follows and is on an action frame:
keyboardlistener = new Object();
keyboardlistener.onKeyDown = new function()
{
if(Key.isDown(80))
{
if(_root.pause)
{
_root.pause = false;
}
else
{
_root.pause = true;
}
}
else if(Key.isDown(81))
{
_root.gotoAndPlay("reset");
}
}
Key.addListener(keyboardlistener);
If anyone can assist me in getting these buttons working correctly it woul be greatly appreciated.
Keyboard Shortcut In Timeline
Is there a way ( a keyboard shortcut) to jump back up levels of clip nesting? Sort of like going back through the _parents without having to click the threads under the timeline...
Keyboard Timeline Control
Hi people. I'm trying something like this:
on (keyPress "<Left>") {
bottom_mc.gotoAndStop(2);
}
But when I put this on the timeline I am told that this action is only permitted but buttons. Can anyone help?
A.
Keyboard Shortcut In Timeline
Is there a way ( a keyboard shortcut) to jump back up levels of clip nesting? Sort of like going back through the _parents without having to click the threads under the timeline...
Multiple Keyboard Input
Hi
I've got MX
Code:
on(keyPress "<Right>")
{
this._x += 5;
}
on(keyPress "<Up>")
{
this._y -= 5;
}
how can I make it go diagonally?
thx
all help appreciated
Keyboard Input Game
I would like to create an alphabet game for my daughter similar to this one
http://www.ctw.org/sesamestreet/game...tentId=9495524
what actionscript do I need to use
Input Box Using US Keyboard Settings?
Hi all,
I'm using a UK keyboard (where the " and @ signs are switched) and firefox to access my flash movie and when I press the @ sign on the keyboard, it will input a " sign.
Is there any reason why this should happen?
The Best Way To Handle Keyboard Input
I'm using the following code structure to handle keyboard input in my Flash game:
Code:
Key.addListener(this);
keyStateArray = new Array();
function onKeyDown(){keyStateArray[Key.getCode()] = true;}
function onKeyUp(){keyStateArray[Key.getCode()] = false;}
function interpretKeys(){if (keyStateArray[Key.RIGHT] && !keyStateArray[Key.LEFT]){moveRight();} else if (keyStateArray[Key.LEFT] && !keyStateArray[Key.RIGHT]){moveLeft();}}
keyInterval = setInterval(this, "interpretKeys", 15);
This code works for Flash Player version 8.5 and up (the earlier players have a bug that prevents the system from working correctly), and because my Flash game will be released as a projector, I'm not even worried about what version of Flash Player the user has on his/her computer.
But, based on the performance of the computer, this system operates faster or slower relative to the actual game. For instance, for my Mac, setting the duration of keyInterval to 15 is a reasonable speed, and the keys repeat fast enough to keep up with the game. On a friend's PC, however, the keyInterval needs to be around 25.
I could theoretically determine whether the game is running on a PC or Mac, and adjust the duration as a result, but the user's OS really has little to do with his or her computer's clock speed. Does anyone know of a better way to implement this sort of system? Perhaps there's a way to do this without worrying about the computer's performance.
[F8] Components And Keyboard Input
Im using the numeric stepper and combo box components. I want to only change their values by clicking on them however they, by default, can also be changed with keyboard input (up,down, and tab buttons specifically).
Does anyone know how to disable a component from listening to keyboard presses?
Keyboard Input Problem
I'm having a consistency problem with my KeyboardEvent Down and Up event handlers.
When I test the movie within Flash CS3 the KeyboardEvent works perfectly, always registering a key change. But when I test it in the Flash 9 Player it's inconsistent. Sometimes I'll hold a key down and it won't do anything until I let go and press it again.
My code is really simple as seen here:
Code:
public function KeyPressedDown(event:KeyboardEvent):void
{
if (event.keyCode == LEFT_KEY) {
_leftKey = true;
} else if (event.keyCode == RIGHT_KEY) {
_rightKey = true;
} else if (event.keyCode == UP_KEY) {
_upKey = true;
} else if (event.keyCode == CTRL_KEY) {
_fireKey = true;
}
}
public function KeyPressedUp(event:KeyboardEvent):void
{
if (event.keyCode == LEFT_KEY) {
_leftKey = false;
} else if (event.keyCode == RIGHT_KEY) {
_rightKey = false;
} else if (event.keyCode == UP_KEY) {
_upKey = false;
} else if (event.keyCode == CTRL_KEY) {
_fireKey = false;
}
}
Anyone know what the problem might be? I was thinking that the stage might be loosing focus so I put extra code in to reset it each frame. But that didn't fix the problem.
Fullscreen With Keyboard Input
Says this is only possible in AIR in the livedocs - anyone know if there is a workaround for Flash? Using Javascript perhaps?
PMF
Issues W/ Keyboard Input
Can anyone tell me why the A and S keys are not reducing the scale of the movie clip? The W and D keys work fine to increase the scale.
ActionScript Code:
stop();
var h = 1.0;
var w = 1.0;
stage.addEventListener(KeyboardEvent.KEY_DOWN, hearKey);
function hearKey(event:KeyboardEvent):void {
if (event.keyCode == 87 ) {
h+=.02;
oval.scaleY = h;
}
if (event.keyCode == 83 ) {
h-=.02;
oval.scaleY = h;
}
if (event.keyCode == 68 ) {
w+=.02;
oval.scaleX = w;
}
if (event.keyCode == 65 ) {
w-=.02;
oval.scaleX = w;
}
}
Thanks.
Disabling Keyboard Input
So I have this flash and it's working pretty well. There are 3 frames: intro frame, a frame with one demo, and a frame with another demo.
The third frame demo utilizes keyboard input that modifies the size of an object. The problem is that the input also modifies the object on the second frame (the object exists in both frames).
So what I want to do is only have it listen for the keys ASWD and R keys in the third frame, not the first and second. I cannot figure out the correct way but it seems like it should be easy...
Maybe an if statement that only adds the listeners if the user's currently on the third frame. "If current frame = 3 then..."
I'm just not sure on the syntax. Thanks.
American Keyboard Input?
Hi, not sure if this is an ActionScript issue or not, but I've created a Flash form but in Firefox the input forms are using the american style keyboards, i.e. the @ key is "shift no.2" but in Internet Explorer it's UK...
Any ideas why this is? Personally i want it to behave like IE, UK style, as it should really.
Keyboard Class Input
The class i'am making is a basic class for the player (persona) and for some reason the keyboard inputs dont work, I made a trace statement in every input and nothing shows up and there are no errors.
I also use a function to import the land and use it to test for colisions.
Edit: forgot to say that the object that is linked to the class is added on stage with the document class.
ActionScript Code:
package
{
import flash.display.MovieClip;
import flash.events.*;
import flash.ui.Keyboard;
public class persona extends MovieClip
{
public var grav:Number = 0.2;
public var vel:Number = 0;
public var lspeed:int = -2;
public var rspeed:int = 2;
public var goleft:Boolean = false;
public var goright:Boolean=false;
public var attemptJump:Boolean=false;
public var mapa:MovieClip;
public function persona()
{
addEventListener(Event.ENTER_FRAME, run)
addEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
addEventListener(KeyboardEvent.KEY_UP, keyReleased);
}
public function receberMapa(map:MovieClip):void
{
mapa = map;
}
private function run (e:Event):void
{
this.y+=vel;
vel +=grav;
if (this.hitTestObject(mapa))
{
vel = 0;
}
if (attemptJump == true)
{
vel =- 5;
}
if (goleft == true)
{
this.x += lspeed;
}
if (goright == true)
{
this.x+=rspeed;
}
}
public function keyPressed(event:KeyboardEvent):void
{
trace("key pressed");
switch (event.keyCode)
{
case Keyboard.UP :
attemptJump = true;
trace("key up pressed");
break;
case Keyboard.LEFT :
goleft = true;
trace("key left pressed");
break;
case Keyboard.RIGHT :
goright = true;
trace("key right pressed");
break;
}
}
public function keyReleased(event:KeyboardEvent):void
{
trace("key released");
switch (event.keyCode)
{
case Keyboard.UP :
attemptJump = false;
trace("key up released");
break;
case Keyboard.LEFT :
goleft = false;
trace("key left released");
break;
case Keyboard.RIGHT :
goright = false;
trace("key right released");
break;
}
}
}
}
Could someone please show me the light...
Keyboard/Mouse Input Lag In IE
So I ran into this problem a few weeks ago, and after a lot of testing I've narrowed it down to a flash player bug in IE7.
Basically what happens is the mouse variables (mouseX and mouseY) will lag in a high performance flash when a key is held down (but not when no keys are held). Here's a test I did: Link to the swf
I attached the code that's in that test.
Here's where it get's weird though. The lag only happens in IE, and you can stop the lag by loading a flash in another tab. Try running these tests:
1. IE with no other tabs open (Lag)
2. FF (No lag)
3. IE with a flash open in another tab (No lag)
I tried embedding the test and another flash in the same html page, but the lag was still there, so it has to be in another tab for it to work.
At this point I guess what I'm looking for is some hack or workaround that will force the input to behave properly. Any ideas?
-----------------
Attach Code
import flash.events.*;
var FPSCount:Number = 0;
var SecondInterval:Timer = new Timer(1000,0);
SecondInterval.start();
SecondInterval.addEventListener(TimerEvent.TIMER, FPSCounter);
addEventListener(Event.ENTER_FRAME, Main);
function Main(event:Event) {
System.resume();
cursor.x = mouseX;
cursor.y = mouseY;
FPSCount += 1;
for (var a = 0; a < 200000; a++) {
Math.random();
}
}
function FPSCounter(event:Event) {
FPS.text = "FPS: " + String(FPSCount);
FPSCount = 0;
}
Edited: 08/18/2008 at 08:32:34 AM by Kajenx
Fullscreen And Keyboard Input On AS3.
Hi, I'm creating an AS3 application that can be put on fullscreen if the user wants. However, when this happens I loose all keyboard support. I don't mean only key reading entry but even areas for text input don't work. Is this normal? How can I solve this?
Keyboard Input Problem
I've been trying to figure out how to use Keyboard events, so I tried out an example I saw online, but I ran into a problem. It's supposed to tell me whenever a key is pressed, and it works for keys such as ctrl and shift, but not for letter keys. For example, when testing in Flash ("test movie"), if I press "v", the Flash player doesn't react, but the Flash editor switches to the selection tool (keyboard shortcut "v"). How do I fix this?
Here's the code I used:
function reportKeyDown(event:KeyboardEvent):void
{
trace("Key Pressed") ;
}
stage.addEventListener(KeyboardEvent.KEY_DOWN, reportKeyDown);
Keyboard Input Pause?
I want the user to be able to press and hold the arrow keys to move an object around the stage. When the button is pressed, the object moves once, pauses for a second, and then continues moving. How do I get rid of this pause?
Here's part of the code I used:
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
function keyPressed(evt:KeyboardEvent):void
{
if (evt.keyCode == 37)
{
this.Player1.x -= 1;
}
}
[MX] Keyboard Input Problem
ok, I'm making a top-down shooter game. I have keyboard input that moves the ship around and fires a laser. everything works perfect except that when the ship moves diagonal up left, or diagonal down right, the laser can't fire at the same time. It will work in any other direction, including the other diagonals. Just not those two : (
here is my code:
ActionScript Code:
function captureKeys() { if (Key.isDown(Key.RIGHT) && ship.x < 355 ) { ship.x+=ship.right } else if (Key.isDown(Key.LEFT) && ship.x > 50) { ship.x+=ship.left } if (Key.isDown(Key.UP) && ship.y > 22) { ship.y+=ship.up } else if (Key.isDown(Key.DOWN) && ship.y < 500) { ship.y+=ship.down } if (Key.isDown(Key.SPACE) && okToShoot) { okToShoot = false; var newDepth = ++depth; var name = "projectile"+newDepth; var linkage = "laser"+ship.laser; var clip = _root.attachMovie(linkage, name, newDepth); clip._x = ship.x; clip._y = (ship.y -20) clip.ymov = -25 clip.onEnterFrame = function() { this._y += this.ymov; if (this._y < 0) this.removeMovieClip(); }; } else if (!Key.isDown(Key.SPACE)){ okToShoot=true } }
is this a common problem among movement in games? or do I just need to fix something?
Keyboard Input Question
Hi all
So I'd like to get my SWF to respond to the user when they just type a word. For example, when they type "hello" , my SWF does some action.
Most of the stuff I've seen is entering text into a text field and then pressing the Enter key or clicking a button.
What I'd like is to type a secret code word and then some easter egg happens. No button clicks, etc. I thought maybe a key listener but that's only one key, how do I get it to work with a whole word?
Thanks in advance.
Limit Keyboard Input
I have several input text fields that should take Hex input. I want to limit keyboard input to a-f, A-F, 0-9, left/right arrows, and backspace. I can determine which key was pressed easy enough; I just don't know how to cancel an unwanted keystroke. This seems like it should be very simple, however, I have not been able to find an answer.
Keyboard Input Problem
Used this forum a long time to answer my actionscript questions, first time posting so thanks to anyone who can help me out.
I'm not quite sure why this isn't working and I'm sure you guys know. I am just trying to get my keyboard input working. This is my document class:
Code:
package {
import flash.display.MovieClip;
import flash.events.*;
public class Simon extends MovieClip {
public function Simon() {
function keysDown(event:KeyboardEvent):void {
if (event.keyCode == 103) {
trace("7");
}
if (event.keyCode == 105) {
trace("9");
}
if (event.keyCode == 97) {
trace("1");
}
if (event.keyCode == 99) {
trace("3");
}
}
stage.addEventListener(KeyboardEvent.KEY_DOWN, keysDown);
}
}
}
no errors, but doesn't work...thanks again
[MX] Keyboard Input Problem
ok, I'm making a top-down shooter game. I have keyboard input that moves the ship around and fires a laser. everything works perfect except that when the ship moves diagonal up left, or diagonal down right, the laser can't fire at the same time. It will work in any other direction, including the other diagonals. Just not those two : (
here is my code:
ActionScript Code:
function captureKeys() { if (Key.isDown(Key.RIGHT) && ship.x < 355 ) { ship.x+=ship.right } else if (Key.isDown(Key.LEFT) && ship.x > 50) { ship.x+=ship.left } if (Key.isDown(Key.UP) && ship.y > 22) { ship.y+=ship.up } else if (Key.isDown(Key.DOWN) && ship.y < 500) { ship.y+=ship.down } if (Key.isDown(Key.SPACE) && okToShoot) { okToShoot = false; var newDepth = ++depth; var name = "projectile"+newDepth; var linkage = "laser"+ship.laser; var clip = _root.attachMovie(linkage, name, newDepth); clip._x = ship.x; clip._y = (ship.y -20) clip.ymov = -25 clip.onEnterFrame = function() { this._y += this.ymov; if (this._y < 0) this.removeMovieClip(); }; } else if (!Key.isDown(Key.SPACE)){ okToShoot=true } }
is this a common problem among movement in games? or do I just need to fix something?
Keyboard Shortcut For 'Next Frame' In Timeline?
Anyone seen anything like this before?
If you're working with many, many frames in the timeline and you could just press a kotkey combo instead of dragging the mouse over there to highlight the next frame, it'd be pretty handy.
Keyboard Shortcuts For Timeline Don't Work
Hello All,
None of the Timeline keyboard shortcuts for "Move Keyframe" (Up, Down, Left, Right) nor "Select Frame" (Left, Right, Above, Below) work for me. Period and comma move the playhead, and I can copy/paste frames, but I cannot select additional frames and cannot move them up, down, or over with the built-in commands. Other keyboard shortcuts work just fine for me.
I've used the default settings, made my own, tried using combinations that don't use the ctrl, alt, or shift keys for the shortcut... nothing seems to help. I've also used two different keyboards with different drivers, and have reinstalled Flash - nothing fixes it.
WinXP Pro sp2, 1.8 GHz Athlon Processor, 1 G RAM, 500+ Gb drives with plenty of extra space. Flash 8 Pro installed on a drive other than C:.
I have searched the forum and the knowledge index on and off for a few weeks now, but haven't seen anything about this issue.
Thanks to anyone who can give me some insight into this.
Keyboard Events Controlling Timeline
I'm fairly new to this, so it could be something really easy (I hope)
I want to control what frame I'm on with the "F" keys. Right now both F keys bringing me to frame 6 instead of F4 bringing me to frame 4.
Attach Code
stage.addEventListener(KeyboardEvent.KEY_DOWN, reportKeyDown);
stage.addEventListener(KeyboardEvent.KEY_DOWN, reportKeyDown2);
function reportKeyDown(event:KeyboardEvent):void
{
if (event.keyCode == Keyboard.F4);
{
gotoAndStop(4);
}
};
function reportKeyDown2(event:KeyboardEvent):void
{
if (event.keyCode == Keyboard.F5);
{
gotoAndStop(6);
}
};
stop();
Keyboard Shortcut For Playhead In Timeline?
I heard there was a keyboard shortcut that you can move the playhead in the timeline one frame at a time. I've tried the obvious left and right arrow keys and they just moved the object within the keyframe. In other words, you could be on a particular frame, and by use of this keyboard shortcut you could either move forward or back, one frame.
Does anyone know of this shortcut???
Thanks,
Bob Gordon.
Navigating In The Timeline With Keyboard And Mouse
I am currently working on creating a presentation in flash that contains similar functionality that PowerPoint has (minus the cheesy effects and graphics...hence the reason I'm doing it in Flash). What I am needing to do is have the flash movie go back and forth from "slide" to "slide" via the left and right arrow keys on the keyboard. I've thought about setting it up so that when either the left or right keyboard arrow is pressed, it then goes to the previous or next frame label in my movie to display the information present under that frame label. That would require setting up a lot of individually named frame labels. Is there a way to use variables in conjuncture with frame labels so that I can do this more efficiently? I was wondering if setting up frame labels like the following "label1", "label2", etc and then telling flash to go to that frame but adding either a "++" to take the current label and add "1" to it or "--" to subtract "1" from the current label number. Would something like that work?
I've also thought about writing some functions that contain the code to do this and then using those to advance or rewind the presentation. Any thoughts?
I hope this isn't too confusing. Please let me know if you have any idea of how to make this kind of functionality in Flash without having to label everything.
Thanks!!!!!!
phil
Keyboard Shortcuts For Moving Thru The Timeline?
Quick question:
Are there any keyboard shortcuts for moving frame by frame thru the Timeline in Flash? I'm used to video editing apps and am confused. I did experiment and found on my PC if I hold down Shift key and scroll the clickwheel on my mouse, I can move thru the Timeline sort of frame by frame, but this isn't perfect as it's hard to control.
Thanks in advance
Detecting Keyboard Input In Another Program, Help
I would like to know how to make it so that if someone is entering some word into a java app on a webpage, it will enter it into a swf that is running either off of thier computer in the background, or off of thier web browser. Are there any ways to do this?
MIDI Keyboard Input Question
I am looking for a good tutorial on using a MIDI keyboard as an input device.
Basic: I want to create a piano tutorial and have the ability to play the lessons from the MIDI.
I have created a Mac computer keyboard for input to play basic piano tones
using TellTarget, but using a MIDI keyboard would be ideal.
Thanks for any information.
Nick
Change Direction W/ Keyboard Input
as3 question:
I have code that allows me to control the player by moving it around the stage with the arrows on my keyboard.
what if I want the player's visual position to reflect the arrow as well.
as in the arrow is pointing like this --> BUT if user clicks the left arrow the arrow not only starts moving towards the left but looks like <--
the code I have is:
as always, grateful for your help.
Code:
package {
import flash.display.*;
import flash.text.*;
import flash.events.*;
public class KB_Control extends MovieClip {
public function KB_Control() {
//from keyboard
// initialize arrow variables
var leftArrow:Boolean = false;
var rightArrow:Boolean = false;
var upArrow:Boolean = false;
var downArrow:Boolean = false;
// set event listeners
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPressedDown);
stage.addEventListener(KeyboardEvent.KEY_UP, keyPressedUp);
stage.addEventListener(Event.ENTER_FRAME, movePlayer);
// set arrow variables to true
function keyPressedDown(event:KeyboardEvent) {
if (event.keyCode == 37) {
leftArrow = true;
} else if (event.keyCode == 39) {
rightArrow = true;
} else if (event.keyCode == 38) {
upArrow = true;
} else if (event.keyCode == 40) {
downArrow = true;
}
}
// set arrow variables to false
function keyPressedUp(event:KeyboardEvent) {
if (event.keyCode == 37) {
leftArrow = false;
} else if (event.keyCode == 39) {
rightArrow = false;
} else if (event.keyCode == 38) {
upArrow = false;
} else if (event.keyCode == 40) {
downArrow = false;
}
}
// move every frame
function movePlayer(event:Event) {
var speed:Number = 5;
if (leftArrow) {
player.x -= speed;
}
if (rightArrow) {
player.x += speed;
}
if (upArrow) {
player.y -= speed;
}
if (downArrow) {
player.y += speed;
}
}
}
}
}
Backspace Form Input Without Keyboard?
I need to allow backspace functionality in a form that's run on a kiosk so there's no keyboard - inputs are entered via touchscreen. Adding characters and clearing the field alltogether is already there, but I can't figure out how to backspace to remove one character at a time
here's a snipet of what's going on:
BUTTON "M":
on(release) {
inputone = inputone + "M" ;
timer.gotoAndPlay(1);
}
CLEAR:
on(release) {
inputone = "" ;
timer.gotoAndPlay(1);
}
inputone is the variable that is sent to the database
Any advice would be greatly appreciated.
|