ActionScript 2.0 :: Get An Object To Move On The Press Of A Key And Stop When Release It?
Apr 8, 2003
well i'm trying to get this object to move on the press of a key (keeps moving if you hold it down) and stop when you release it, but all i'm gettin, is when you press it, it moves on forever and never stops....
There's no problem in my computer at work on this issue. When I press on something that is draggable, it's dragged. When I realease it (or realease it outside), it stops being dragged. But it does happen in my boss' computer! what a coincidence! It happens to be something related to very quick double clicks. Sometimes, the draggable movieclip gets stuck to the mouse movement even if it has been released. Is there something to take control on this? or is it any issue from an old version of the flash plugin?
Before I start I would like to point out Im new at actionscipt. I want to move an object from a to b on a mouse press using actionscript to ease out. The only threads I can find involve huge scripts I know it should only be a couple of lines!
I am trying to create a scrolling text section for a cd-rom I am creating.I have created buttons for the scroll up and scroll down and so far all I am able to get is a click click click to scroll up and down 1 line at a time.Would prefer to make a loop so when you hold down the button it "scrolls" until you release.Have had no luck in setting variables on press and release.
this should be pretty simple for most, but I would like an explanation more than just a quick code fix. I put all the script together for this object, here is the fla. What I want to do is move it up to the y position as it does, but I need the object to move faster and stop there. Since I have given most of script in the main movie, I don't know how to write the script for the button release. All I can get it to do is crawl up with targety=100; but I still have the problem with the mouse follow once my button is pressed.
How can I use another setInterval function so, when the movieclip reaches the limit (in this case 100 pixels), it stops, waits for 1 second and starts the letsMove function again?
I just got Flash CS3. I'm trying to get my main timeline to stop in the begining, on button press to play and at the end stop again. In AS2, you would just put stop(); on the first keyframe and stop(); on the last key frame and program your buttons accordingly.
The stop(); does not work!!!! It's driving me crazy. What am I missing? I've gone through the tutorials in Flash and they don't work either.Also, if you have MovieClip that contains an animation and you don't want the movie clip to be on a continuous loop how do you stop it from playing. In AS2, I would put a stop(); on the last keyframe of the movieclip's animation. This also does not work in AS3.
i have an object that i want to drag and drop with the same event.Something like on press start drag and on press again stop drag. I'm sure it's pretty simple with and if and else statment but i can't find how to do that...The best i have done so far was this:
When stop streaming, i close NetStream, close NetConnection, clear video, and remove any event listoner on camera. After these actions, the camera is still in used.
Im making a soundboard and I chose AS3 by accident.What I need the code to do is STOP the CURRENT sound from playing if another is pressed. the code that worked for AS1 and AS2 was onMouseDown [code] plays the sound once and messes the sound up after playing for only half a second or not at all.
Sorry to have to post a secondary thread...but i've had responses to the previous one and now a new problem exists. Why am I having to multiple click my button to make this function work? On each release of the button 'SUB' moves that little bit more but I need the function to work in one go after just one click!! Something is obviously working for it to move at all, I just dont understand why it's moving in stages!!
I have 4 buttons,(home, about, gallery, contacts). and each button have their own animations, when you rollout/over them. well, this is my problem, i want to stop animations when i release the button. pls help me with that. i was so confused about that.
i want a my_mc to move when i press the < LEFT> arrow but also to fire and onEnterFrame event so it will move.. and also to delete the onEnterFrame when the key is not pressed so the onENterFrame is not going on in the background
I got a character to move. I want the player to be able to move the character to a button then press spacebar on it. Which will take them to another frame.
This is the code I got for the button but the trouble is u can press spacebar anywhere to go to the next frame.
on (keyPress "<Space>") { _root.gotoAndPlay(23); }
, i want to make a carousel -type gallery like the one from the tutorial but with a slight variation: i want it to move only when i press a button.(move left when i press the left arrow and to the right when i press the right).And i want it to move by one image at a time and i want to know which image is to the front(i've created a dynamic text field called imgName).I hope i'm explaining this correctly and i'm attaching an example with two arrows with no actions on them.
I'm trying to make a series of images move on button press. The first will appear on the stage when the pages loads. There will be a next button which will make the current image move off to the left of the stage and the next move in to the stage from the right and stop in the center. There are about 10 images.
I also have to do the same to another page but with text and moving in vertically instead of horizontally. I have posted this at the bottom (as the images one is too big to post). Although this version is the one I did with tweens that did'nt work, you can have a play with it if you like?
this works fine, just wondering if anyone has another way to handle it. it seems excessive to have 4 handlers for touch input, but i cant figure out any other way.
TOUCH_OVER and TOUCH_OUT check a switch statement to enable/disable buttons within buttonContainer.
TOUCH_BEGIN and TOUCH_END are used to store points and get a "swipe angle" (only if TOUCH_END is not over a button)
my only problem is i started having glitch's i think becuase so many listeners including: ORIENTATION_CHANGE, KeyboardEvents, Event.DEACTIVATE
this is why i ask if perhaps im missing someway to simplify the touch input listeners
Currently i am using this actionscript to move my bg: onClipEvent(enterFrame){ if(!Key.isDown(Key.UP)){ Mouse.hide(); this._x =-_root._xmouse+400; this._y =-_root._ymouse+200; } }
This makes it so the background will follow my mouse, and when i press up key it will stop following, but when i let go it will still follow, i want it to stop perminantly even after i lift my up key without haveing a new frame involved.
I am having some dificulty making a path for this enemy i'm trying to create... cause i want him to rotate + move, then stop, then shoot, then rotate back and move off screen... Its easier if you see it.. you can download the swf file in the zipped archive to demonstrate what i mean. I did it there with tweens. Anyway.. i tried and make it but i'm a little stuck on the stopping part... you can also see what i did in the fla file attatched...