ActionScript 2.0 :: KeyPress Not Working But Code Works On Button
Jan 28, 2009
[code]It works fine when I press the button but not when I press the enter key.Just to set the context I want users to be able to use enter to enter an answer into a grid before moving on to the next cell. My cells are all labelled A1, A2 etc so that I didn't get confused. As I am and will always be a newbie I couldn't figure out a function to do what I wanted so came up with what is probably a long winded way around: store the textfield instance name in an array and then call the item in the array in conjunction with setFocus - like I say it works when I click the button (which I intend to hide off screen).
View 10 Replies
Similar Posts:
Jan 21, 2008
//This is my original code which works fine when my button is present on the root timeline
btn_up.onRelease = function() {
getURL("javascript:Launch('website.html', 2000, 1200)");
[code]....
View 2 Replies
Sep 24, 2008
I have a movieclip that will rotate by 10 right if the right button is pressed, or 10 left if the left button is pressed.Now, some genius tell me why the right button code works perfectly, but when i press left it doesnt rotate. It moves left, but no rotation to be found .heres the code
onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
xspeed -= power;[code].....
View 3 Replies
Feb 13, 2006
I am trying to make a game where if you press down on a letter key, it fires a bullet. How do i assign the fuction to the keypress?[code]90 is the key number for key "z".fireBullet(); is the function to fire the bullet. It is working.
View 7 Replies
Sep 30, 2004
is there a code that will disable key press all together or to focus on just the input box so that i can type with the space key (space is used to pick objects up in game not in use when this menu is open anyway).
View 4 Replies
Oct 22, 2007
I have code on my flash that allows the user to tab to certain buttons and press enter to enter it... but when ever I hit return with the keypress code it wipes the .swf file and goes blank... is this something to do with refreshing?
Code:
var EscapeListener:Object = new Object();
EscapeListener.onKeyDown = function() {
if (Key.getCode() == 27) {[code]....
View 1 Replies
Nov 12, 2010
I am a high school teacher who is teaching Actionscript 3.0 for the first time. I am teaching my students how to create multiple scenes to understand actionscipt interactivity. The first scene has a button. The second scene has something happen when a key is pressed. The problem is that the second scene doesn't work. Flash doesn't even show the trace command that a key has been pressed. Keypresses work fine when done in the first scene, but when put in the second scene after a button has been pressed, it doesn't recognize the keypress event.
View 1 Replies
Jun 21, 2010
I'm having a problem with PC applications. Notably, the keypress command no longer working when my app is fullscreen. It works just fine on Mac, but bugs out and doesnt recognize and of my KeyPress actions when fullscreen. When its not fullscreen, it works. I dont know what to do, as i need my apps to play fullscreen on both pc and mac.
View 1 Replies
Jun 9, 2011
I've literally been staring at this for 7 hours. I'm missing something.I have two movie clips on the stage. The instance name of the first is puzzleAK. The instance name of the second is pieceAK.The first is linked to a custom class called GeoPuzzle. The second is linked to a custom class called GeoPiece.The code compiles but throws an error (as explained).The code in the main timeline:
puzzleAK.fullName = "Alaska";puzzleAK.abbrev = "AK";puzzleAK.isLocked = false;trace ("made it through puzzle definitions: " + puzzleAK.fullName + " " + puzzleAK.abbrev + " " + puzzleAK.isLocked);
[code].....
View 7 Replies
Mar 3, 2010
I am trying to make an interactive presentation, where you can push down on different keys and show different layers in my image. [URL]. If you open this .swf and press the "Q,W,E,R,T" keys you can see what I mean. It was working fine with the layers associated with the "Q W E" keys, but once I started adding more, I cannot press and reveal more than 3 layers at once (try pressing different combinations of three keys at once and you should see that not all of the layers appear, but each key works individually).
Here is my AS3:
Code:
import caurina.transitions.*;
mc_aerial.alpha = 0;
mc_01.alpha = 0;
mc_02.alpha = 0;
mc_03.alpha = 0;
mc_04.alpha = 0;
stage.addEventListener(KeyboardEvent.KEY_DOWN, mc_aerial_KeyDown);
function mc_aerial_KeyDown (e:KeyboardEvent):void{
[Code] .....
View 2 Replies
Feb 20, 2011
Ok so I have this simple animation I created of a circle that moves from one side of the stage to the other. I have added a new layer and called it buttons. On this layer I have added 2 buttons. One for start and another one for stop. The purpose is to get my circle to move from one side of the stage to the other but be able to use my buttons so that I can start and stop the animations at random times during playback. I fixed all my compiler errors now the problem lies in that everytime I click the start or the stop button I get an output error. I have a 3rd layer in which is titled actions and this is where all my code is posted. I removed that layer and placed my code in the first frame of the buttons layer to see if this would change anything but I still get the same output errors. So I just added back my actions layer. What could I be doing wrong? I have made sure to name all my movie clips and buttons correctly and I even added an instance name to them.[code]Here is my code and the errors I am getting when I press the play and stop button on test.Error #1009: Cannot access a property or method of a null object reference.
View 10 Replies
Oct 30, 2011
This code works fine for my flash site:
ovbutton.addEventListener(MouseEvent.CLICK, fl_ClickToGoToWebPage_5);
function fl_ClickToGoToWebPage_5(event:MouseEvent):void
{[code].....
However, within firefox (7.0.1), once the back button is pressed the button does nothing. Works great with every other browser. It basically only works once, until I reload the page.
View 18 Replies
May 25, 2010
Just run into an odd little problem. My project allows for the user to press numbers on the keyboard to call specific functions accordingly.It all works fine, until the user goes into "fullscreen" mode. When they are in fullscreen mode, keypress actions no longer seem to work at all. Have I missed something out with an EvenListeners? Or have I overlooked something entirely?Here's a sample of how the keyboardEvent is being used:
Code:
stage.addEventListener(KeyboardEvent.KEY_DOWN, keypress);
function keypress(keyEvent:KeyboardEvent) {
[code]......
View 2 Replies
Jul 21, 2010
I had a forum up a few months ago, and got help getting radio buttons to work with a continue button, causing the movie to gotoAndStop at a particular frame. (This is all being done on the main timeline).Everything was working fine, now, I keep trying to do it again, but regardless of which button I click, it only goes to frame 2 where the Novice radio button is supposed to go.I think the problem is in the line of code that reads:varframeNumber=2+Number(noviceButton.group.selectedData)I know it is set to only go to the novice area, but my understanding was that since these were radio buttons, any button clicked would work, and I only needed to type in one of the unique instance names
Here is the code:
stop();
continueButton.enabled=false
[code].....
View 14 Replies
Apr 9, 2011
I'm making a Flash piano for a school project and I've got everything working perfectly except for the keystrokes.The piano keys are button symbols.When I click on the C button on the virtual piano, it plays a C note and presses down the button.When I press the "a" key on my keyboard, it plays a C note but doesn't press down the button.How can I get it to look like the mouse clicked it when I press "a"? This is what I have on the key right now (and bare with the simple coding; my teacher doesn't do anything harder than what's below):[code]
View 5 Replies
Oct 17, 2009
I'm trying to make a movie clip play with an off-screen button that activates it by using a key. The instance name for the movie clip is "leftbuzzerlights" and the key that's supposed to play the clip is the letter "Z". Here's the code:
ActionScript Code:
on (keyPress "z") {
leftbuzzerlights.play();
[code].....
View 6 Replies
Nov 11, 2008
i need script on button.. onKey press, but i need button like "escape, F12, etc.." ( on press moviego to next frame )..
View 1 Replies
Oct 17, 2011
I've got this piece of code which is basically a start button that reacts to being clicked on. I'd like to change that into starting the function by pressing Enter on the keyboard. I'm having trouble figuring it out since the code is already in a function. How do I make it react to keypresses?
[Code]...
View 1 Replies
Oct 24, 2011
I am attempting to create an interactive piano. Right now, I have my keys layed out and each key is a button. On the down frame of that button is where the sound plays. What I want to do now is to allow the user to press a button and when they do so, the down frame of that button will trigger, thus playing the sound.
View 1 Replies
Oct 6, 2011
I'm making a screensaver which includes a game, when the .swf file is converted to screensaver format the only way to exit is to press Escape.
I was wondering if there is any way to simulate a keypress (Escape) when the user clicks a button so that I can also have Exit buttons?
View 0 Replies
Dec 27, 2010
Is there a way to make code on the timeline and code in a separate AS file communicate with each other?I have two buttons, a yes button and a no button.I have a confirm box which is a movie clip. In the movie clip I have the two buttons on it and code so that every time one of the buttons is clicked it runs a function.I have the rest of my code for the movie (so the code to make the confirm box appear) on a separate AS file.Is there a way I can define the functions on the movie clip and run the functions with the separate AS file?
View 7 Replies
Mar 8, 2011
I have 2 frames in my movie, 2 buttons and a video. On the first frame there is code for button #1. On the second frame i have code for button #2 but I'd also like to appear on the first frame. The problem is that when I put the code for the second button on the first frame, the video won't play. so I can only have it on the second frame. I can't figure out why the code, which works when its on frame 2, then won't work on frame 1. When I put the code on frame 1 it breaks the functionality and the video won't play.
[Code]...
View 8 Replies
Sep 2, 2009
The following code only works when i publish in flash 6. I think you have to define the variables before they are used, but i can't for the life of me figure it out.
Code:
questionSetXML.onLoad = function(success) {
if (success) {
[code]......
View 3 Replies
Jun 26, 2005
i'm using "iloveitaly"s easing scrollbar class, and it works great. however, i added an effect that i want on my scrollbar, and it doesnt work quite how it should. what should happen is when u press the dragger, it should duplicate itself and then fade out, giving it kinda a "mouse trail" type effect i guess you can call it. anyway, here is the code for the part in the class that doesnt work:
Code:
private function onPress() {
startDrag(this, false, lockPos[0], lockPos[1], lockPos[2], lockPos[3])
[code].....
View 1 Replies
Jun 19, 2004
I have a few buttons in the main movie. One of them loads a music player and an external file into the stage. Music player been loaded by javascripts.It works, but especially after using other buttons which do other jobs,it happens that the javascript code doesn't work.Should it be some optimization in addition to the code: ?
getURL("javascript: myFunction(parameter)");
[/AS]
mx-guest2004
View 2 Replies
Jan 20, 2009
I'm using Flash CS3, exporting for flash player 9 and having troubles with the code below only in Firefox 3 (flash player 9 or 10).In IE 6 & 7, all works OK.The code below should show small thumbnails of images. It does work on everything I tested except firefox 3. What is weird is that if I empty my cache and load the page online, it does not show any thumbnails or sometimes only one. However, if i reload the page without emptying my cache, it will then work perfectly.Here is my code :
Code:
System.security.allowDomain("http://www.translucidedesign.com");
var prefix = 'http://www.translucidedesign.com/kana/';[code]..........
View 16 Replies
Dec 4, 2009
I've got several buttons in a tween (graphic) and a few movieclips in two of the buttons. They all have the same code
[Code]....
but this code works only on buttons, not on movieclips.
View 0 Replies
Jan 21, 2010
i have here 2 very similar pieces of code, the first is supposed to make the movie clips larger on roll over and it does, the second, which is based on the first, is supposed to move the movie clips to the right on rollover, but it does not. the file names and class paths are not an issue, ive tested these pieces of code with copy and paste
Code:
package
{
import flash.display.MovieClip;
import flash.events.MouseEvent;
[Code]...
View 2 Replies
Jan 27, 2011
I've written a simple preloader which I've put in its own movie clip. The code is as follows:
[code]...
The code works out a value between 0 and 1 called 'loadVal' this is used to animate a masking object a distance defined by a variable called 'yShift'. loadVal is rounded up to give a whole number that is displayed in a text field showing the percentage of the movie which has loaded.The preloader seems to be running and it will trigger the move to play when it completes but I can't see the preloader previewing in the Bandwidth Profiler, even when I set the data speed to be very slow. I've noticed this issue before and it is annoying as I need to see how the preloader looks and works.
View 4 Replies
Sep 26, 2010
i have this code that should get a face (eyes, shape, etc) in motion on Mouse Over. The thing is i dont know how to loop this onMouseOver code so it works like an onEnterFrame handler (while onMouseOver).Another way to put it: as long as the mouse stays over the Mclip i want the code to loop. How can i do this?Here is my code:
Code:
package{
import flash.events.MouseEvent;
import flash.events.Event;[code].....
View 2 Replies