ActionScript 2.0 :: Do Sth While Mouse Pressed?
Oct 18, 2010
I made a button and want do something when mouse is press, I mean when mouse is pressed that button should do its job. When button release scale of image will increase, now, I want it to do while mouse is pressed.should I use loop or conditional statement?
View 7 Replies
Similar Posts:
Jul 26, 2006
I have a very simple piece of code but it has one very annoying bug. When I press the button a second time, the code doesn't work. The only way to get the code to work is by moving the mouse a tiny bit, or moving the mouse off the button and back on. make a button that can be clicked many times without moving the mouse?
Code:
randommultiquiz.onPress = randommultiquizOnPress;
function randommultiquizOnPress() {
_root.attachMovie("connect", "newconnect", 200);
newconnect._x = 0;
[code]....
View 9 Replies
Mar 10, 2005
my interface consists of two graphical moviclips: A and B (B is a palette that contains several movieclips). it should work like this:
- click mc A to show mc B (initially hidden).
- while the mouse is still pressed, hover over the various mc:s of mc B. keep track of the mc:s i have hovered over in an array.
- when the mouse button is released, hide mc B.
so... i need to generate somekind of event (like onRollOver) while my mousebutton is pressed. however onRollOver is not fired when the mousebutton is pressed.
View 2 Replies
Nov 19, 2009
How can I make onRollOver work, when the left mouse button is clicked? When mouse button is released than rollOver work's, when I press and rollOver to some object it wont work.
View 1 Replies
Jan 17, 2005
Is it possible to detect when a user is clicking while simultaneously pressing a button on the keyboard? For instance, if a user presses "a" on the keyboard and then clicks on a specific movie clip, I'd like to trigger an animation.
View 3 Replies
Oct 1, 2004
I'm working for a client that wants me to create an interactive map, which I can zoom in/out, move the map around, have a minimap guide, and other goodies. I've got the bulk of it created, but I got stuck trying to create a gamepad type controller which the user can click on, and it will move the map.
What I'm trying to do is this: The gamepad graphic I created is like a typical Playstation/X-box style thumbpad controller. There are an up, down, left, and right arrows graphic which the user can click to make the map go up, down, etc. (I have created code to let the users use the keyboards, in case they don't want to use the graphics)
Is it possible to create a continous movement when the mouse is pressed, or will my poor user be stuck clicking the mouse ad-nauseum?
View 4 Replies
Oct 11, 2010
I m using textarea. The problem is when i try to select a text and go out of stage and leave the mouse then again move mouse on text then selection of text will move with the mouse.
Here is what causes that:click somewhere on the text and drag the mouse in order to select the text then go out of the swf leave the mouse now move mouse on textarea -> the selection of text will move with the mouse...
How to stop this behavior?I tried to implement mouseleave on stage but the problem is i m not able to detect mouseleave event when mouse is pressed and it leaves the stage.
View 3 Replies
Mar 8, 2012
I'm listening for MOUSE_MOVE events.They are sent and received just fine unless the middle mouse button is held down. I don't get any more MOUSE_MOVE events until the middle button is released.Is this an issue with Flash, or something to do with my specific ouse/computer configuration (bluetooth Mighty Mouse on Lion)?Are there any known workarounds?Here is a sample project to demonstrate the problem.Left click and drag traces mouse move events, but middle click only shows middle mouse down and middle mouse up.
import flash.events.MouseEvent;
this.stage.addEventListener(MouseEvent.MIDDLE_MOUSE_DOWN, onMiddleMouseDown);
this.stage.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
[code]....
View 2 Replies
Feb 3, 2011
I can't figure out, the Keyboard Input won't work until Mouse Button is pressed. Here's the code to the class I'm having trouble with. If anyone can see what's causing the trouble that would be great.
package
{
// Import necessary classes from the flash libraries
import flash.display.Sprite;
[Code]....
View 1 Replies
Apr 5, 2009
I want to trace a text if the mouse is pressed (MouseDown) and is it's on a movieclip (DragOver,RollOver)...can't manage to put all the 3 condition allong for the script to work...
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
Oct 11, 2010
I m using textarea in flash 10 cs5 as3. The problem is when i try to select a text and go out of stage and leave the mouse then again move mouse on text then selection of text will move with the mouse.
Here is what causes that:
* click somewhere on the text and drag the mouse in order to select the text
* then go out of the swf
* leave the mouse
* now move mouse on textarea
the selection of text will move with the mouse. How to stop this behavior? I tried to implement mouseleave on stage but the problem is i m not able to detect mouseleave event when mouse is pressed and it leaves the stage.
This is because of wmode="opaque" parameter. I found out that it doesn't do this when wmode="window". Is there a solution for this?
View 1 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
Jun 24, 2010
I have designed a menu that When you mouse over it, a custom cursor appears. When you mouse down it disappears and when you mouse up it returns. If you happen to mouse down and then drag the mouse off of the menu (whilst in mouse down) and then mouse up outside the menu, the custom cursor disappears. All good. The only issue is: If you happen to mouse down on the menu and then drag the mouse off of the menu AND off of the stage, i.e the SWF (whilst in mouse down) and then mouse up completely off of the stage, the custom cursor appears at the point it left the menu. I have tried to fix this using MOUSE_LEAVE but this dosnt work when the mouse button is pressed down. I have attached an FLA, SWF and the AS below.
Code:
stop();
import com.greensock.*;
import com.greensock.easing.*;
import flash.events.MouseEvent;
[code]....
View 1 Replies
Jun 29, 2010
Is there anyway to display the name of the key pressed on KEY_DOWN events? For example, if the user pressed the 'w' key I would want the SWF to print out 'w' and NOT the corresponding key code.
View 6 Replies
Sep 26, 2009
How can i test to see if the S key is pressed? (all i need to do is gotoAndStop)
View 12 Replies
Apr 18, 2010
I am trying to play a sound and display a graphic when a key is pressed , so far i have been able to play my sound when i press the 'a' key but i also want to display a graphic that gets displayed while the key is down , i have created the graphic as a movie clip, not sure if thats right, iam not sure of the code i need to display the graphic.
View 1 Replies
Oct 13, 2010
I have 2buttons. Each have 3stages: up, over, down.I want to have 1st button to stay on its 'down state' when pressed and then you should see 2nd button 'up' stage(down stage of 1st button is the same as up stage in 2nd button).If someone hovered again you see 'over' stage of 2nd button,when will click, button move to 'up' stage of 1st button.
View 1 Replies
Jan 18, 2011
I was making an application with AIR+Flex.
One Feature is like: when 'alt' key is down, the mouse cursor changes to B, when 'alt' key is up, the mouse cursor restores to A.
But the problem is that everytime a release 'alt' key, the mouse cursor will change back to system default (Arrow shape), and seems like the focus is on somewhere outside the stage.
That reminds me that, when 'alt' was pressed in a ordinary window, the menuBar will be focused.
How can I stop this default behavior?
p.s. I have tried the following ways and doesn't work:
1) listen to stage's KEY_DOWN/KEY_UP event, and add 'event.stopImmediatePropagation()' in the event handlers
2) listen to stage's KEY_DOWN/KEY_UP event, and add 'event.preventDefault()' in the event handlers
3) listen to stage's KEY_DOWN/KEY_UP event, and add 'this.setFocus()' in the event handlers. And 'callLater(this.setFocus)' doesn't work too.
View 1 Replies
Sep 18, 2011
Does AS3 have a way to output the physical name of a key that has been pressed? (ie. "You pressed: Left Arrow")
The obvious solution is to convert the character code to a string, but this only works for things like the alphanumeric keys. Ctrl, Alt, etc have special cases, but this still doesn't help for things like the arrow keys or the F-keys.
Another possibly naive option is to have a Key, Value pair for all the keycodes and their names. It should be almost trivial (if tedious) to code this myself, but since AIR already has things like
KEYNAME_LEFTARROW : String = "Left"
I was wondering if this ability is already built in somewhere without having to keep my own collection of strings.
View 1 Replies
Aug 11, 2009
I have a problem in keyboard event as3 is detecting only one key event.How to check whether two key is pressed
View 9 Replies
Aug 17, 2009
I am trying to make a movie clip fade in after several movie clips are pressed. It does not matter what order they are clicked in-Just as all of them are pressed. Does anyone know what this is called so i can find a solution?
View 3 Replies
Mar 18, 2010
I've search around quite a bit but can't seem to find and answer to this seemingly simple question.
I have a project which listens for keystrokes in an onClipEvent. One of those keys is P. What I want is to simulate the pressing of the P button.
View 2 Replies
Mar 18, 2006
How do I make it check if a key is NOT pressed? Like after releasing a key.
View 3 Replies
Apr 15, 2007
I am trying to figure out how to check when the key "A - Z" is pressed...How can I use ASCII characters to check this?, or even if I check something like this
if(Key.isDown(Key("A")))
How to check when keys A-Z are pressed, preferably something like this
onKeyPress("A") = function() {
"run code"
}
Anyway to do this? Basically hotkeys, press "s" to call a line of function that will save the game.. etc...
View 3 Replies
Apr 2, 2008
I'm writing a program that has a button, and when pressed, and the shift key is pressed, will do an action. I have an onRelease function for that button also, but for some reason when I have the button pressed, and I press shift or any other key, it automatically thinks the button is being released. I was using the onMouseDown, onMouseUp functions before, but they caused me a lot of problems aswell.
Try it for yourself:
Code:
btn.onPress = function() {
trace("pressed"); //now hit a keyboard button
}
[Code]....
View 2 Replies
May 28, 2009
My actual project I need a event configuration wherein I can hold a keyboard key down and move mouse. While trying to implement this, I recognized that the flashplayer begins to lag, saving actions in buffer and playback them when the KEY_DOWN event is already over...
For example I have a
PHP Code:
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, false, 0, true);
And in the handler I got only this:
PHP Code:
private function keyDownHandler(event:KeyboardEvent):void {
if (event.keyCode == 88) manoverDrive = true;
}
I also do have a
PHP Code:
stage.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
In this enterFrame I do animation for a movieclip that is animated regarding the mouse and keyboard action and events. Now when I hold down any kind of key the animation of this moviclip gets slown down if I hold down the key for 10 seconds and then lift the keyboard key the mouse movements I made before gets somehow saved and the animation got a playback of the mouse movements. I removed the keyboard eventlistener and the behaviour stays. Is that an official flash player Bug?
View 3 Replies
Sep 13, 2010
Im getting kinda frustrated as I try to come up with a simple way of telling when a key was just pressed... I've used both senoculars KeyObj class and the KEY_DOWN event, but i dont quite work as a would want the to work (if i press enter I get a zillions events - i just want ONE).
View 1 Replies
Jun 30, 2004
i havea problem i have this code so if the F1 key is pressed a movieclips ._x changes
[Code]....
but when i play my flash file in ixplorer and i press F1, ixplorer's help page pops up, is their some acrionscript command to disable iexplorers key pressings or maybe java script, i know you can disable it from within iexplorer but i want my flash to be universal without having to explain to viewers what they must do to get it to work
View 1 Replies
Mar 9, 2009
What I have is a series of buttons created via attachmovie based on XML nodes. I want to make sure all buttons are all clicked. What I have below is the onRelease of the button and I need to put my checkDone function in there because of the XML onLoad function. What I am struggling with is how to check if each has been clicked. Typically I would just do like but1==true but that does not seem to work.
_root["but"+b].onRelease = function() {
function checkDone(whichbut) {
done = true;
[code]....
View 2 Replies