ActionScript 3.0 :: Stop Keyboard Action Repeating When Key Is Held Down?
Apr 10, 2009
I'm developing a game for my final year project at university that has a character who can move up and down on screen. The upper half of the screen is reflected in the lower half so that there are actually two characters on screen at once, each reacting exactly the same way to keyboard input.One of the mechanics involves the two avatars changing positions relative to their halves of the screen which requires a spacebar press to execute. The problem I'm having is that I don't want the characters to change positions once every frame if the spacebar is held down. I need to implement some sort of delay once the spacebar is pressed so that the characters won't swap positions for another second or so.
Code:
var plachaFlipPointY:Number = char.mc.y;
var shadowPlachaFlipPointY:Number = schar.mc.y;
[code]....
View 8 Replies
Similar Posts:
Nov 10, 2011
I have a simple Flash movie, and have used AS3 to allow users to hit the up arrow and go to a certain frame, then hit the right arrow to go to another specific frame. My problem is the minute I put in "stop();" in the script so my movie stops on frame 1, the keyboard controls do not work unless I double-click the playing video. The minute I remove the stop command from my actionscript, the keyboard controls work perfectly...but my movie obviously starts playing which I do not want.
I need both the stop command AND the keyboard controls, and am at a loss.
View 12 Replies
Jan 28, 2010
this one has got me stumped. I want an object to move 10 pixels every time a key is pressed, and I don't want it to keep moving when the key is held down.And I want to know why it moves once, and then waits a bit before moving more. I do not see why anyone would want it to do that!!!
View 1 Replies
Feb 1, 2010
what the actionscript would be to make a button be clicked and held down with the mouse a certain amount of seconds before executing an action???
View 8 Replies
Jul 20, 2011
rotating and moving along y axis... its position in the stage is x = 120 and y = 20 base on its properties.. but when i test it, tracing(_y) shows dat d first value comes 42.85 and not 20(value from the properties).. i dont know how to get its exact value just like what is seen from the properties.. i've tried to have an if statement that if the value of _y = to the y coordinate the blade position will alter its movement(at first its _y -= 2; going down movement, id like it to alter its movement when _y turns = 90), it never turns like i want. here is my facebook email add(URL)
[Code]....
View 6 Replies
Apr 30, 2010
now I'm trying to make the keyboard events to stop repeating.
My idea was to have a true and false condition for when the key is pressed so that it wont repeat if the key is down already.
//Mouse Event Over
keyCButton.addEventListener(MouseEvent.MOUSE_OVER, function(){gotoAndStop(2)});
//Variable
[Code].....
doing this makes the key loop over and over without a keyboard event I think i need to add a "&& keyDown..." to "if (this.soundplayed==true)" but i dont know how to do it without getting errors
here is the keyboard player i'm trying to fix [URL]
View 2 Replies
Nov 29, 2011
I have sound attached to the button, and it's played when the button is pressed. How to do that after pressing button, sound is played continuously? Without action script.
View 12 Replies
May 8, 2009
I have a slideshow that is looped ... it contains 5 slides.I am using a gotoandPlay action to control the slide show.
on (release) {
this._parent.gotoAndPlay("98");
}
There is a fade transition between slides.When a button is released ... I want to gotoandPlay (frame 98) ... and then have it stop 10 frames later on (frame 108). Frame 98 includes the transition ... if I just gotoandStop on frame 108 ... I loose the transition.Is there any way to incorporate a stop action, after a gotoandPlay action on my button ... without naming instances etc.I.E.
on (release) {
this._parent.gotoAndPlay("98");
STOP ON FRAME 108 INTEGRATED HERE
}
Everything I have attempted is not working.
View 1 Replies
Sep 25, 2010
I have a website with a mc inside a mc. The nested clip keeps repeating , I want the nested clip to run 1 time. I have stop actions on each clip, it delays, but won't stop repeating.
View 6 Replies
Mar 10, 2010
I am dynamically playing a video.flv file on the stage when a button is clicked. It plays fine but continuously repeats itself. I want it to play once and the disappear.
View 2 Replies
Nov 9, 2010
In AS3 how do I stop a repeating key press?I just want to press a key once and something happen.My code you hold the key down and the action repeats.
private function getkeyDown(e:KeyboardEvent):void {delete dict[e.keyCode];} private function getkeyUp(e:KeyboardEvent):void {dict[e.keyCode]=true;} private function check_keys(){....if (dict[Keyboard.DOWN]==true) { myplayer.movedown(mybackList); ...
View 1 Replies
Mar 22, 2010
I have converted a short clip to an .swf file, i want to implement it on my website:
<object width="400" height="300">
<param name="movie" value="movie.swf">
<embed src="movie.swf" width="400" height="300">
</embed>
</object>
When i play it it autoplays (that's fine) but it also keeps repeating over and over, i'd like it to stop at the end and just display the end frame (as mentioned i converted a movie so i cant do it with actionscript in the .fla file).
View 1 Replies
Dec 14, 2011
I have a .fla that plays music until a certain text object (start_course_txt_mc) is visible. Then I want the music to stop and the narration to begin. I can get all that to happen. The problem is that the narration keeps playing over and over, but it is only playing about 3-4 seconds of an audio file that is about 30 seconds long.
function unBlur()
{
var my_bf:BlurFilter = new BlurFilter(0,0,1);
[code]....
View 3 Replies
Feb 24, 2006
How can i stop it from repeating??
var wait = function () {
//mystuff
}
var myTimer = setInterval(wait, 5000);
View 6 Replies
Oct 26, 2009
how do i stop an animation from repeating once it has finished executed.
What i had wanted to do: was to play an animation once when the player has been hitted by a rock and increased an animation counter. So after say, the counter has reach 2, the animation will stop. But when i tested it out, the counter only execute once yet the animation just keeps on playing.
Code:
var j:int = rockArmy.length - 1;
var rock:Rock;
while ( j > -1 )
[Code].....
View 4 Replies
Feb 18, 2010
The script for my timer worked for one button but as soon as I set up the other 2 buttons to do the same, I started having a problem where the rollover action would go after the set amount of time was up but then would repeat itself once after the set amount of time was up again. just to clarify, if it needs it, the reason I don't have a rollout attached to these buttons is because I want the menu to stay out until you leave the menu area
so I have an invisible button called menuin_btn which sits to the right of the menu and covers the rest of the stage where the content will be, so you have to rollover that area for the menu to roll back in. The "rollin" in my code brings the movie clip to frame 16 (the end) where I have a gotoAndStop(1); command to get it back to frame 1 so the rollover can be used again. I've attached a zip with my current flash file and swf and here is what my current script looks like on the main scene:
[Code]...
View 3 Replies
Jan 4, 2010
I must not be looking in the right area as it seems there is no way to search one particular Adobe product at a time, only "Search Forums" which means I get a bunch of useless results to "keyboard navigation" and "keyboard shortcuts" and the above subject. I am a novice user with a novice question for which there doesn't appear to exist any readily available information for which means I don't expect anyone will answer this question but I'll go ahead with it anyway in the hopes that maybe someone will read this w/in the next few months.
Here is what I'm wanting to do:
First I want to establish a list of frames on the timeline I would like the user to be able to jump to at the press of a keyboard button say the down arrow. Say this list consists of the following frame numbers, 1, 5, 10, 15, 20. I would like that if they are watching the movie on frame 12, upon pressing the down arrow it will jump to frame 15 and if they are on frame 22 upon pressing the down arrow it will jump to frame 1 etc.. I do not however want it to direct them to frame 1 if they are on frame 12 and press the down arrow for the first time.
This seems like a severely easy question (at least the part about keyboard navigation) for which I would expect they would have it in the Adobe classroom in a book or some official tip or direction about how to do this w/out possibly having to spend 15,000 years learning a coding language to do one goddam thing!
View 2 Replies
Jun 25, 2009
It's good to be around! I understand some action script and have managed to write a few codes. However, I haven't been able to write the appropriate code to add a keyboard action to a button that already has a button action. [code]...
View 2 Replies
Jun 25, 2009
It's good to be around! I understand some action script and have managed to write a few codes. However, I have played around with the code to add a keyboard action to a button that already has a button action. [code]...
View 0 Replies
May 26, 2010
I couldn't come up with a good title for this question but basically the problem is this - I've got a series of thumbnails and clicking on a thumbnail loads a larger picture into a holder movieclip on the main stage. However, if you click another thumbnail while the first picture is still loading, then both pictures load and it goes on from there. How can I make my code so that clicking a new thumbnail cancels any actions from previous clicks?
View 7 Replies
Nov 19, 2003
I put the "stop" action at the end of my movie on the last keyframe, but the movie doesn't stop!
View 14 Replies
Sep 3, 2006
I have a script that I found on here posted by Salvador Marley.It is supposed to load these sub-menus (which are movieclips in the library, MC01, MC02, etc...) into an empty movieclip when certain links are clicked from the main menu.The code works for loading the movieclip from the library, and even switches the movieclip when I choose the next link all like it's supposed to do.However my problem is that it will play the sub-menu movieclip, but it will not stop at the end. It constantly loops. I have tried to put the stop command in several places throughout my entire .fla but it doesn't stop. The sub-menu's transitions just keep repeating over and over again. How do I get it to only play the sub-menu movieclip once and then stop? [code]
View 3 Replies
Jul 26, 2011
Is there a code in as 2 for a button which when clicked : Expands the browser fullscreen ( IE etc) just like the keyboard F 11 button does . I want to make one button in flash movie which when clicked sends the same command to IE/Firefox , which the F 11 keyboard button does . Have been searching the web for the same ...
My idea is not to creat a popup ...but just to command the browser for expanding fullscreens
View 14 Replies
Apr 17, 2009
I'm making a very simple menu in Flash CS4 using AS3. I have a stop() action on the first frame of my scene, but it keeps getting ignored and looping the whole thing. The only other code is that telling the buttons to gotoAndStop on certain frames.[URL]...
View 5 Replies
Aug 6, 2010
I know how to use flash but i'm not highly advanced.I have started creating a website for a friend and when I have placed the stop action where I would like it to be on both scenes it still plays in a loop once i test the movie (ctrl+enter).
View 2 Replies
Apr 12, 2011
I want the video not to loop, but to stop on the final frame of the video. I want to add that action before publishing the SWFas3 file. I need a litle advice. I went to last frame and right-clicked on Actions. I don't know what to put in the dialog box.
View 2 Replies
Apr 4, 2012
its been a while since ive used flash,and im struggeling with a command id normaly do within seconds.im trying to add a stop action on one of my layers,i know the action script is stop ( ) ;but i cant recall how to add it only to the particular layer. im affecting the whole scene when i add a new layer and do the action.
View 3 Replies
Jun 16, 2010
This is my AS code:
onClipEvent (enterFrame) {
this._x = Math.random()*2+90;
this._y = Math.random()*2+60;
this._alpha = Math.random()*30+50;
}
It is applied to the movie clip. I am having trouble figuring out how to STOP to action. I want it to stop after 10 seconds. How do I do this?
View 2 Replies
Sep 10, 2009
I can't even get a stop action to work.Ok I have a simple little tween of a box moving across stage. The instance name of the box is "box_mc" the tween ends on frame 25 on frame 25 on an actions layer I have the following actionScript3 written:
ActionScript Code:
import flash.display.MovieClip;
box_mc.stop();
View 2 Replies
Dec 5, 2009
I have a stop(); action on the last frame of my main timeline, but it's not working. The movie just keeps on looping.
I've tried:
addEventListener(Event.ENTER_FRAME,myFunction);
function myFunction(event:Event) {
stop();
}
but that doesn't work either. Neither does this.stop();
View 3 Replies