ActionScript 2.0 :: Jumping When Space Is Pressed
Aug 11, 2006
I need to know what actionscript(2.0) to use in order to make my movieclip(player) jump when i press space and switch to another movieclip(player_jump) and then switch back to "player" when it reaches the ground. otherwise i won't be able to get my skateboarder to ollie(just so you know what kind of game it's going to be). my movieclips(sorry about the watermarks...)
View 14 Replies
Similar Posts:
Oct 10, 2010
I want my sound to start when I hold the space button and stop when I release it.It should loop all the time when space is pressed down.
View 1 Replies
Sep 5, 2009
ive tested my game on several different computers. it works well on my desktop, but 2 laptops suffer an issue when left, space and up are all simultaneously pressed... thus the character is unable to move, jump and shoot at the same time
View 2 Replies
Aug 12, 2010
I am testing this script (in flash cs5 as2) on a simple character (a dot).The script implies that the character goes up when space bar is pressed down and that he will otherwise continue to fall due to the artificial gravity i have applied.My problem is that you can only click space bar once and make it go up and then after that it will fall and space bar wont work.the problemThis is the script.
onClipEvent (load) {
acc = 2;
time = 0;
[code]......
View 4 Replies
Sep 30, 2011
Im trying to make my character attack, the attack animation is inside the character movie clip on frame 4. But i dont understand how to do it? I want him to attack once, if SPACE is pressed. I have tried this:
[Code]...
View 1 Replies
Nov 16, 2004
I have a function on root:
_root.fadeBox_mc.onEnterFrame = function (){
if (fade){
this.nextFrame();[code]....
This causes a mc to fade in and out on rollover/rollout. But what I wanna make is a box that fades in when pressed on the button and fade out when pressed for the second time. But if I say
on (press){
_root.fade = true;
}
the mc fades in, but I cant do another on (press) to fade out. Is this too confusing?
View 2 Replies
Dec 6, 2010
I am struggling a bit with keys on the keyboards controlling a movieclip to happen.Ive got a person moving when pressing right and left, and a movieclip with three frames: First frame is a movieclip with the person standing still, looking bored. The second frame is the person moving right, and the third frame is the person moving left.This is the code that Ive inserted into the persons actions on scene1:
if (Key.isDown(Key.RIGHT)) {_x += speed;this.gotoAndStop(2);_xscale = +scale;}
if (Key.isDown(Key.LEFT)) {_x -= speed;this.gotoAndStop(3);_xscale = -scale;}
this code works alright accept that when the keys are not pressed it doesnt stand still, the legs are still moving, so I tried to include this code aswell:
if (!Key.isDown(KEY.RIGHT)) [code]....this makes the person standing still when not pressed but not moving the legs when turning right and left.
View 3 Replies
May 10, 2009
I'm adapting this iTunes coverflow style gallery for my own purpose [URL] Basically, the locations of the artwork and the URLs for when you click on a picture are stored in an XML file. Is it possible to adapt the AS or XML so that instead of opening a URL, clicking on a cover jumps to a particular frame on the timeline? Basically what I want to do is have the first and last items acting as previous and next buttons to go to a different frame on the timeline. I guess what i need to do is get the actionscript to do whatever is within and replacing that with the action I want it to perform?
View 2 Replies
Nov 19, 2010
I have this rather cool code for a _mc on a slope. The only problem I am having is making the sprite.mc change states/animation when the sprite.mc is jumping.here's the code I have:
onClipEvent(load){
speed = 5;
gravity = 0;
r = _height/2; //radius
[code]....
View 1 Replies
May 4, 2010
I have a piece of code in AS3 but it doesn't work with AS2:
stop();
function login(event:MouseEvent):void
{
this.gotoAndPlay("first_page");
[Code]....
But I still have a problem. I have stops in each key frame but when I play the movie it shows directly the first_page section skipping all other frames before it.
View 4 Replies
Jun 28, 2010
I have made 2 scenes. I am trying to jump 1scene to next scene you can find source file from here
scene1 is LoderScreen
scene2 is GameScreen and frame label is "start"
I did this gotoAndPlay("start","GameScreen")
But it is showing error/
Original FLA file [URL]
View 3 Replies
Jun 25, 2011
I am wanting to fade out of a frame and then fade into another, and the way i was thinking of doing this was to code a tween to alpha 0 and then use the code:
home_btn.addEventListener(MouseEvent.CLICK, startMovieHome);
function startMovieHome(e:MouseEvent):void
{
[Code]....
I dont know how to ask it to tween and then go to the label "home" once the tween is complete..
View 1 Replies
Mar 26, 2010
Okay so im making a game for a class...im using flash player 8....i need an actionscript code for looping a background that i have. i need an actionscript for having my character jump..
View 1 Replies
Jul 5, 2011
ok so i know you can use gotoAndPlay to jump to a different frame but how do you jump to a curtain line of code in that frame
View 7 Replies
Nov 11, 2011
What I created was just a test but I can't seem to get it working. What I did was create a very small rectangle at frame 1. Created a tween and then at frame 100 made it a very large rectangle.
Then in my code I wanted the user to MOUSE_OVER something and the rectangle to ease to the length it was at frame 30. However I keep getting this error message:
ArgumentError: Error #2109: Frame label frame 30 not found in scene Scene 1.
at flash.display::MovieClip/gotoAndStop()
at Untitled_fla::MainTimeline/test()
Here is my code:
[CODE]
stop();
circle_mc.addEventListener(MouseEvent.MOUSE_OVER, test, false, 0, true);
circle_mc.addEventListener(MouseEvent.MOUSE_OUT, test2, false, 0, true);
[Code].....
View 5 Replies
Mar 9, 2006
I want the button in my flash movie to jump to seperate html page called bios.html and go down to the anchor "kbrown".
I tried putting this code on the button. It went to the correct page but didn't scroll down to the anchor
Code:
on (release) {
getURL("bios.html/#kbrown", "_self");
}
[Code].....
View 2 Replies
Sep 12, 2004
how to jump to a scene that is identified by a variable?
I've tried:
New_Scene = "Scene 3"
gotoAndPlay ([New_Scene],1);
and all iterations thereof... No luck.
View 5 Replies
Feb 23, 2011
I have a maths-based movie on which a number of points are allocated depending on the answers given to a series of multiple choice questions.
At the end of it, a person will score somewhere between 1 and 10 points depending on the answers they gave.
I have got to the stage where the system keeps track of the cumulative score, and at the conclusion, I have a text field on stage, which has an instance name of "results". When the person enters the frame, the results field displays the total number of points scored.
That is ok, but what I actually would like to happen is that the movie jumps to a different frame based on that figure, so that if they score 2, it would take them to the frame labelled "two" and if they score 9, it takes them to frame "nine"
Is there a way of effectively saying:
On frame enter
if results.text = 1 go to "one";
if results.text = 2 go to "two"
etc etc
I'm guessing that I need to use the:
_root.onEnterFrame = function(){
};
how to describe the bit in the middle...?
View 4 Replies
Sep 6, 2010
I made this Flash banner few months ago for this website [URL] When I play the banner on my computer everything is fine but when is on the web you can see the saccade (the image is jumping it is not smooth)
View 2 Replies
Jan 23, 2012
I'm having trouble getting my character to fire. it seems to fire when he jumps, but not while standing. I have attached my code to the zip file below:This is the code I used:
onClipEvent (load) {
var gravity:Number = 0;
var speed:Number = 5;
[code]....
View 1 Replies
Oct 31, 2009
i'm making a photo gallery in flash AS3. I have two buttons, prev and next, what i want is when you are at the last image end press next, you jump to the first image. I have tried to google it and searched for an answer, but cant find anything. This is my code so far.
picture.stop();
rbutton.addEventListener(MouseEvent.CLICK,
clicknext);
lbutton.addEventListener(MouseEvent.CLICK,
clickprev);
[code]...
View 1 Replies
Aug 24, 2006
In an alphabetically sorted array, I want to jump from one letter to another. So, when Im with a word beginning with a, I want to jump to the next item beginning with etc
Ive set up this simple script, which simply look at the first character of the current item, then loop in the (sorted) array until it finds a different first character It works very well hen descending! But when ascending, the script sees that there is character change but this is not the first item beginning with that letterbut the last one (since we are coming from bottom to top)
And of course I would like the script to give me the very first item beginning with a new letter.
(So, to summarize, I want to browse an array alphabetically, up & down, so that each time I press on the UP arrow key, I go up in the alphabet.and when I press the DOWN arrow key, I go down in the alphabet)
[Code]....
View 3 Replies
Dec 28, 2006
This isn't working right. From what I understand, it should, but it doesn't.
Code:
on(release){
var targetFrame = this._currentframe;
if(targetFrame == 10){
[Code]....
The trace returns "1" every time I press the button.
View 6 Replies
Jun 20, 2003
How can you switch between scenes by f.e. pressing a button I thought of using loadMovie but then I have several .swf files and I'd like everything in 1 swf file
View 7 Replies
Jan 21, 2009
I'm learning AS3 as I modernize the VCR controls for our e-learning topics. The way we used to do it was load the wav into the timeline and keyframe to the audio. We have a little tracker bar you can click on to jump around, a tracker icon you can drag, play/pause and FF/RW buttons. In AS2, since the wav was in the timeline, I just had to worry about frame numbers.
It seems like the modern way to do it is to load the audio as an MP3 externally. How accurate will this be as far as sync'ing the audio to the animation when using the tracker bar and jumping around? I'll basically be mathematically slicing the bar graphic into pieces and using that to tell the animation what frame to start on, and converting that to a time for the audio to start.
View 4 Replies
May 12, 2009
I really want to smooth the animation a little bit more.i want the animation to look smooth, no jumping or stopping, want continuous
View 1 Replies
Jul 7, 2010
I have a video (that im calling from my harddrive) that i would love to play once through,then jump onto the next frame (where theres another video that continues from the end of the first). Why can i not use the following code to jump?
on(complete){
gotoAndStop(5);
}
View 1 Replies
Apr 29, 2011
I am trying to make a button jump to a label in the main timeline from within a movieclip but I dont think i have the syntax etc correct. I'm getting "access of undefined property _root" when I run the following code. Any ideas what I'm doing wrong here? heres the code..
menuButton_IN.pHome_IN.addEventListener(MouseEvent .MOUSE_DOWN, onPressHandler);
function onPressHandler(myEvent:MouseEvent){
_root.gotoAndPlay ("home");
[code]......
View 2 Replies
Mar 30, 2011
This is the predicament Im in. I have 3 files:
Launch.exe
video.swf
pause.swf
In the launch.exe, I have a loadmovie command which loads the external file video.swf. When the video is loaded, I want the viewer to be able to hit the SPACEBAR at any time which will result in pausing the video (pause.swf appears on screen) and after 3 seconds unloads the video.swf file and jumps to a frame label on the Launch.exe timeline. The code below is what I have at the moment but it doesn't work.
[Code]....
View 2 Replies
Mar 24, 2011
I tried to get this right but it just won't work for me. It's probably something very simple. I have a video in a movieclip on my timeline. On the first frame, I have the stop(); command. I want to be able to hit the SPACEBAR: which results in pausing the movieclip and jumping to frame 2 on the timeline.
View 8 Replies