Stage mouse events
Hi everybody,
i need a simple method to check if the mouse left the
application and when i comes back in.
i tried
private function
creationCompleteHandler(event:FlexEvent):void
this.addEventListener(MouseEvent.MOUSE_OUT,
mouseOutHandler);
this.addEventListener(MouseEvent.MOUSE_OVER,
mouseOverHandler);
but these events ALSO fire when i move the mouse onto a
button that is added to the stage (without leaving the stage).
another thing is how can i check a drag of a object to the
outside of the swf?
in AS2 there is a event "releaseOutside" that does the job,
is there something similar in Flex2 aswell?
What's this all about? I embedded this flash inside a C++
application and want to do some drag and drop interaction and
communication of flash and c++ via
flash.external.ExternalInterface.
So i must know when something is currently dragged and then
the mouse left the flash.
When i release the mouse outside the flash inside the c++ app
the mouseUp event does not fire of course, thats the other problem.
Hope I made myself clear and someone can help.
Best regards,
Dzihan
Flash 9 plugin does support full screen so that might be one
solution.
There is a Mouse_Leave event in AS3 that can tell you when
the mouse leaves the area of your swf. You would then need to use
externalinterface to communicate with some technology outside of
flash such as javascript or such. I wouldn't know how to do it.
Other than the full screen approach it all seems like a lot
of trouble. Without knowing the exact specifics of what you are
making can't you just have some kind of symbol that indicates the
direction you are going and if they leave the stage area it either
keeps going in the last direction or it returns to center until the
mouse comes back?
Similar Messages
-
Hello
Because i need to do 3d transformation on the whole stage, i set the stage transfromation.matrix3d.
I made one test application and find that mouse event doesn't work properly.
In my application, i simply add a sprite containing red circle and test the functions.
Besides, i scale the stage along x-axis half using stage.transform.matrix3D
The problem is that when i click on my red circle, the e.localX/Y and e.stageX/Y are all zeros.
But if i click on places rather than my red circle be, the e.localX/Y and e.stageX/Y work fine.
Here is my code.
public function init():void{
var m:Matrix3D= new Matrix3D();
m.copyRowFrom(0,new Vector3D(0.5,0,0,0));
m.copyRowFrom(1,new Vector3D(0,1,0,0));
m.copyRowFrom(2,new Vector3D(0,0,1,0));
m.copyRowFrom(3,new Vector3D(0,0,0,1));
stage.transform.matrix3D = m;
s.graphics.beginFill(0xff0000);
s.graphics.drawCircle(0,0,50);
s.graphics.endFill();
addChild(s);
s.x = (stage.stageWidth)/2;
s.y = (stage.stageHeight)/2;
s.z = 0;
stage.addEventListener(MouseEvent.CLICK, onStageClick);
private function onStageClick(e:MouseEvent):void{
trace("global" + e.stageX + " " + e.stageY);
trace("local" + e.localX + " " + e.localY);1. In the code, I think it should change the value of the "player" so that it reflects the right turn. E.g. after the user press the mouse, the player should be changed to "computer" and after the computer goes, the player should be changed to "you". Otherwise, the player stays the same value and the program will only print out one symbol, which in this case is "O".
2. To make the previous moves stay, the code has to get some way to remember the moves. So before the repaint, the program will record the context for the next paint method.
Regards, -
Hi,
I had uploaded jpeg file onto the stage using
File->Import.
Now, how to access the mouse-events using AS3.0?
i.e., when we click with mouse on the stage
it should display the x and y co-ordinates of the point
being clicked.
These x and y coordinates must be displayed in text-boxes
provided down on the same stage.
Please reply meYou can do show/hide movieclip on mouseover. get your box
position and assign to the popup (tooltip movieclip).
see this...
not tested. but it should work.
import flash.events.MouseEvent;
function showClip(evt:MouseEvent) {
tooltips.x = evt.target.x + evt.target.width;;
tooltips.y = evt.target.y - evt.target.height;
tooltips.visible = true
function hideClip(evt:MouseEvent) {
tooltips.visible = false;
box.addEventListener(MouseEvent.MOUSE_OVER, showClip);
box.addEventListener(MouseEvent.MOUSE_OUT, hideClip);
I assume you'll create two movieclips named: box and tooltips -
Somebody please help:
I've taught myself enough with Flash to customize a
fully-Flash template for my wife's website, and two of the buttons
didn't do what I wanted them to in Actionscript. They then began
giving me the message:
**Error** Symbol=sub_butt1, layer=Layer 4, frame=1:Line 1:
Mouse events are permitted only for button instances
on (rollOver) {
**Error** Symbol=sub_butt1, layer=Layer 4, frame=1:Line 4:
Mouse events are permitted only for button instances
on (releaseOutside, rollOut) {
Total ActionScript Errors: 2 Reported Errors: 2
Not only do I not know how to fix this, the same message
comes up for every single button in the entire fla I had saved,
plus earlier versions where I hadn't even messed with the buttons
yet.
Any suggestions?Hello Corbett,
The error is saying that you are trying to apply a button
action to something
other than a button. Often this happens when you select the
frame that the
button is on instead of the actual button, thus applying the
action to the
frame instead of the button.
Make sure you select the button on the stage and then apply
the actions there.
You'll probably have to remove the action from the frame
before it will work
(looks like it's on Layer 4 frame 1).
Good luck!
Jesse H.
Adobe Community Expert
My site:
http://www.jharding.com
Free Blog Radio:
http://www.tornadostream.com
> Somebody please help:
> I've taught myself enough with Flash to customize a
fully-Flash
> template for
> my wife's website, and two of the buttons didn't do what
I wanted them
> to in
> Actionscript. They then began giving me the message:
>
> **Error** Symbol=sub_butt1, layer=Layer 4, frame=1:Line
1: Mouse
> events are
> permitted only for button instances
> on (rollOver) {
> **Error** Symbol=sub_butt1, layer=Layer 4, frame=1:Line
4: Mouse
> events are
> permitted only for button instances
> on (releaseOutside, rollOut) {
> Total ActionScript Errors: 2 Reported Errors: 2
>
> Not only do I not know how to fix this, the same message
comes up for
> every
> single button in the entire fla I had saved, plus
earlier versions
> where I
> hadn't even messed with the buttons yet.
> Any suggestions? -
ComboBox screws up mouse events
I'm having a problem where after selecting something from a
comboBox, the
mouse events sent to buttons and movieClips (that have
nothing to do with
the comboBox) no longer work correctly.
After using the comboBox, if you click on a button or
movieClip, without
moving the mouse, the button or movieClip no longer receives
mouse events
until the mouse is moved.
This is most noticable with something like a "Next" button,
that is clicked
repeatedly without moving the mouse. The first click will
work, then other
clicks will stop working (as well as rollOver). If you move
the mouse just
one pixel over, then it works again.
This is easily reproduced in a test fla. Create a button that
traces
"press" and "release". Put a comboBox on the stage with a few
items and be
sure to name the comboBox instance.
Has anyone experienced this and has a workaround. The only
workaround I
have found is to not use comboBox..OK, I still think this is a bug, but I've found a workaround:
The problem is that the comboBox contains an input text
field, and even if
you have the comboBox's editable property set to false, the
input text field
gets FOCUS when you click on the comboBox. Then when you go
and click on
the button, the input text field still has focus, and not the
button. Why
the button stops working after the first click and release is
what seems
like a bug. The button does not have focus and clicking on it
doesn't give
it focus. You can see the same thing if you put an input text
field on the
stage, play the movie and click in the text field. Even
though you are
clicking on the button, the i-beam is still blinking in the
text box, and
you will see the same messed up functionallity that I
originally described.
Here is the workaround. You have to explicitly give the
button focus.
_focusrect = false; // don't want yellow box around item in
focus
test_btn.onPress = function() {
trace("press");
focusManager.setFocus(this); // this sets focus back to the
button
test_btn.onRelease = function() {
trace("release");
Chris
"Chris" <[email protected]> wrote in message
news:[email protected]...
> I'm having a problem where after selecting something
from a comboBox, the
> mouse events sent to buttons and movieClips (that have
nothing to do with
> the comboBox) no longer work correctly.
>
> After using the comboBox, if you click on a button or
movieClip, without
> moving the mouse, the button or movieClip no longer
receives mouse events
> until the mouse is moved.
>
> This is most noticable with something like a "Next"
button, that is
> clicked
> repeatedly without moving the mouse. The first click
will work, then
> other
> clicks will stop working (as well as rollOver). If you
move the mouse
> just
> one pixel over, then it works again.
>
> This is easily reproduced in a test fla. Create a button
that traces
> "press" and "release". Put a comboBox on the stage with
a few items and
> be sure to name the comboBox instance.
>
> Has anyone experienced this and has a workaround. The
only workaround I
> have found is to not use comboBox..
>
>
> -
Mouse events don't work on a button from a panel ran in a DLL
Hi.
I have a DLL that loads a panel.
Since it's a DLL I can't do the RunUserInterface() function, because the DLL would be stuck waiting for the panel events.
I only do the LoadPanel().
When I click with the mouse on one of the buttons, the pushing down event (simulating the button being pressed) doesn't happen and the callback doesn't run.
But if I press the tab button until the focus reaches the button and press Enter, the callback of the button is executed.
An even more interesting aspect is that this happens when I call the DLL on TestStand, but on an application of mine that calls the DLL just for debug everything works fine.
How can I enable the mouse events?
Thanks for your help.
Daniel Coelho
VISToolkit - http://www.vistoolkit.com - Your Real Virtual Instrument Solution
Controlar - Electronica Industrial e Sistemas, Lda
Solved!
Go to Solution.Hello Daniel,
I got surprised when I read your post, because I am experiencing something almost the same as you do.
I have a DLL (generated by an .fp instrument driver I wrote) which performs continious TCP communication with the UUT.
It starts 2 threads, each for reading from one of the 2 different IPs the UUT has.
Another DLL tests this UUT (with the help of the communication DLL above) by exporting functions to be called by TestStand steps.
If the second DLL wants to display a CVI panel in order to wait for the user response or displays a popup (MessagePopup, ConfirmPopup, etc), user cannot press the buttons.
Actually, there is a point your program and mine differ. I call RunUserInterface and the button's callbacks call QuitUserInterface, so the execution continues after a button is pressed. The problem is buttons cannot be pressed. I also tried looping on GetUserEvent but it did not solve the problem.
There are 2 findings:
1. I had a small exe to test my instrument driver DLL and the popups in it worked pretty well (this coincides with Daniel's findings).
2. We workedaround the problem by shutting down the communication threads in the instrument driver DLL before the popup appears and restrating them afterwards. Although they are separate threads in another DLL, they were somehow blocking user events on another DLL running.
S. Eren BALCI
www.aselsan.com.tr -
Hello everyone,
I'm currently working on an standard as3 (1024x768) app that
is running inside a chromeless Air window to take advantage of the
transparency.
All my tests where done using windows XP professional and AIR
1.0 (the same problem existed in beta3).
The issue I'm having is related with Mouse Events. Somehow
the events take a lot of time to reach the swf file when the user
clicks inside the transparent window.
It's natural that the app runs slower inside a transparent
window (the framerate drops) but I wasn't expecting the clicks to
suffer from such delay (it takes sometimes 2-5sec).
The app is very CPU intensive and the transparencies make it
worse. Something inside the AIR framework is not dispatching the
events properly.
I say this because I tried using the virtualMouse class from
senocular together with a socket to simulate the mouse clicks and
that did the trick.
In conclusion:
Something in the AIR framework for windows XP is messing up
the dispatch of the Mouse events when the app is under heavy cpu
usage inside a chromeless window. I click on the window and it
takes 1-2sec to receive the click event.
However when I dispatch the MouseEvent.CLICK myself using
the virtual mouse class the application immediately receives the
event.
I know this is a strange bug and not many people will have
this problem, but I would like to know from someone with knowledge
of the runtime why this could be happening.
Thank you
Tiago BilouHello everyone,
I'm currently working on an standard as3 (1024x768) app that
is running inside a chromeless Air window to take advantage of the
transparency.
All my tests where done using windows XP professional and AIR
1.0 (the same problem existed in beta3).
The issue I'm having is related with Mouse Events. Somehow
the events take a lot of time to reach the swf file when the user
clicks inside the transparent window.
It's natural that the app runs slower inside a transparent
window (the framerate drops) but I wasn't expecting the clicks to
suffer from such delay (it takes sometimes 2-5sec).
The app is very CPU intensive and the transparencies make it
worse. Something inside the AIR framework is not dispatching the
events properly.
I say this because I tried using the virtualMouse class from
senocular together with a socket to simulate the mouse clicks and
that did the trick.
In conclusion:
Something in the AIR framework for windows XP is messing up
the dispatch of the Mouse events when the app is under heavy cpu
usage inside a chromeless window. I click on the window and it
takes 1-2sec to receive the click event.
However when I dispatch the MouseEvent.CLICK myself using
the virtual mouse class the application immediately receives the
event.
I know this is a strange bug and not many people will have
this problem, but I would like to know from someone with knowledge
of the runtime why this could be happening.
Thank you
Tiago Bilou -
Firefox mouse event not behaving the same on PC and Mac computers
I use the FCKEditor and having a very strange problem. When I click on the FCKEditor's editing area, the keyboard gets disabled untill I click the mouse somewhere outside of the editing window. The problem only happen on Firefox (3.6.10) on Mac computer (Snowleopard 10.6.4). Doing exactly the same steps on PC works without any problem.
What I want to know:
- Is it possible that the Firefox on Mac is different than the PC in handling mouse events? Or some other areas?Sounds more that Firefox is treating that editor area as read-only.
Start Firefox in [[Safe Mode]] to check if one of your add-ons is causing your problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
See [[Troubleshooting extensions and themes]] and [[Troubleshooting plugins]] -
Non modal PopUpManager blocking mouse events
In our application we have a header, footer and center area. We have a situation where we want to block the header and center area with a popup, but leave the footer area so it can be clicked on. The code works fine and it all looks good, except the mouse events are blocked to the footer. If we slightly resize the window (either with the mouse or programatically) it all "wakes up" and starts working. I have tried all sorts of invalidateDisplayList, validateDisplayList, validateNow, etc. I am throwing this out there to see if anyone else has had this problem and if there is something I am missing. I can't easily share my code, but if I don't get a reply I'll put together a code example to see if I can recreate it. Any ideas are very welcome. Been scratching my head at this one for 3 days now.
I should point out that we are using "false" for the modal flag, just in case anyone was thinking that. It all works fine once it "wakes up" through resizing, but I need to make that happen without the resizing.
And we have tried all sorts of "callLater" behavior in conjuction with the invalidate/validate calls. -
Mouse events during Thread.sleep
hi.
I have an applet .
I have a alghoritm simulator.
Everytime I find a solution I call the method Thread.sleep .
I want to pause the application and I create a JToggleButton Pause .
When I press the Pause during sleep mouse event are managed at the end of alghoritm.
How can I manage mouse events during sleep?All UI events (such as mouse events) occur on the event dispatch thread (EDT).
That means if you sleep on the EDT, you lock up the UI. For this reason, you shouldn't be sleeping on the EDT.
I'm not sure what your sleep is trying to do but you need to manage your threads a little more carefully. For instance, any time consuming process which is invoked as a result of a UI event needs to be fired on a new thread to prevent the UI freezing. The fun starts when you have to update the UI as a result of that process, because you should then hook back onto the EDT to avoid the risk of deadlock.
Some utility classes are provided, such as SwingUtilities, and other example code is provided on Sun's site, such as SwingWorker - but if you do much UI work you'll probably end up with your own core set of threading tools and so on to make life easier. -
HTML/JS: Capturing mouse events while Air is out of focus
Hi,
I've been trying to determine if it is possible to receive mouse events (like MOUSE_WHEEL) if the Air window does not currently have focus. I'd like my application to support the mouse wheel for scrolling while the cursor is over the application, without requiring the user to click the application and gain focus. My application uses JavaScript to scroll an unordered list within a DIV set to overflow:hidden (to prevent the native scrollbar from appearing).
Thanks for your help!
AndrewI doubt that AIR would pick up events fired while not having focus. Perhaps you could fake it by creating an AIR project that runs "fullscreen", but has a smaller active window. Anywhere your mouse went it would still capture the scrolling event, but you could conditionalize it so that it only worked in certain areas.
-
Mouse Events at the icon in systray.
My program call library function to add, modify or delete icon into systray.
Additionaly I'd like to get back information when any mouse event had happen under icon in systray like move mouse, right/left button click etc. to display popup menu (as an standart behaviour).
I've tried Windows Message Queue, but it only works inside application window area.
How could I do it ?
Any suggestions, examples or advises ?
Rumcajs.Requirements Price: $29.95
Application Software:
LabVIEW 7.0+
Toolkits Software:
Additional Software:
Language's:
LabVIEW
INVtray LabVIEW Toolkit allows the programmer to create a LabVIEW program that can be hidden from the task bar and accessed through the System Tray. Comes with a sample VI that demonstrates all the features of the toolkit. -
hi,
I am having objects on a JFrame that respond to mouse events. I would like to know how I can disable these events. I use the addMouseListener to register a mouse event on something. Is there a way to remove or to deregister mouse events.
I basically have a game of tiles on a JFrame and I am going to have the human player play against the computer. I want to be able to have turns; computer and human player turn.removeMouseListener()
-
Touch to Mouse events conversion
Hi Everybody!
Does anybody know how correctly fire mouse events to Oracle Maps in javascript?
Default translation touch events in iPad Safari does not quite fit. It try zoom or pan browser window, not map. :(
If catch touch events and disable default translation I can zoom and pan MVMapView object.
But how fire "click","mousemove","mouseover" events on Map? I need dispatch event to ThemeBasedFOIs (InfoWindow Popup and other listeners)?Yes. The Oracle Maps tutorial contains examples (the tutorial can be found in your mapviewer deployment
e.g. http://localhost:7001/mapviewer/fsmc/tutorial/index.html) and documentation in the API reference
(e.g. http://localhost:7001/mapviewer/fsmc/apidoc/index.html). Look at MVEvent and the attachEventListener function of MVMapView, MVThemeBasedFOI, and MVFOI classes for example. -
How to catch the mouse event from the JTable cell of the DefaultCellEditor
Hi, my problem is:
I have a JTable with the cells of DefaultCellEditor(JComboBox) and added the mouse listener to JTable. I can catch the mouse event from any editor cell when this cell didn't be focused. However, when I click the editor to select one JComboBox element, all the mouse events were intercepted by the editor.
So, how can I catch the mouse event in this case? In other word, even if I do the operation over the editor, I also need to catch the cursor position.
Any idea will be highly appreciated!
Thanks in advance!Hi, bbritta,
Thanks very much for your help. Really, your code could run well, but my case is to catch the JComboBox event. So, when I change the JTextField as JComboBox, it still fail to catch the event. The following is my code. Could you give me any other suggestion?
Also, any one has a good idea for my problem? I look forward to the right solution to this problem.
Thanks.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Test3
extends JFrame {
// JTextField jtf = new JTextField();
Object[] as = {"aa","bb","cc","dd"};
JComboBox box = new JComboBox(as);
public Test3() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container content = getContentPane();
String[] head = {
"One", "Two", "Three"};
String[][] data = {
"R1-C1", "R1-C2", "R1-C3"}
"R2-C1", "R2-C2", "R2-C3"}
JTable jt = new JTable(data, head);
box.addMouseListener(new MouseAdapter() {
// jtf.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e)
System.out.println("-------------------JComboBox mouseclick....");
jt.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e)
System.out.println("-------------------JTable mouseclick....");
// jt.setDefaultEditor(Object.class, new DefaultCellEditor(jtf));
jt.setDefaultEditor(Object.class, new DefaultCellEditor(box));
content.add(new JScrollPane(jt), BorderLayout.CENTER);
setSize(300, 300);
public static void main(String[] args) {
new Test3().setVisible(true);
}
Maybe you are looking for
-
Hopefully I can describe this issue accurately enough for some assistance. My MacMini is connected to a TV via DVI and a 3.5 audio connection. Recently, when watching DVDs through Front Row, I have been noticing audio dropout during loud scenes in mo
-
No recovery option for forgotten security answers.
I found a how to on the support page, but there is no tab under the security answer boxes to request to reset themthrough alternate email. I cannot purchase anything on itunes on my windows op. laptop stating it is the first time I am purchasing (its
-
[SOLVED] no sound with 32bit prefix wine
Hello, I am trying to play Ultra Street Fighter IV and I am running into a few issues. My standard wine prefix is a 64bit one. With it, I can play the game, hear the audio fine, but the videos/cut scenes don't appear at all. They're completely skippe
-
Fail to install shockwave player
For some reason I can't seem to be able to install shockwave player. I'm running on a proxy server, is this maybe the reason? many thanks wow cheats | brain synchronization
-
Why won't the phonegap build add-on show up in my dreamweaver ?
why ? why ? what is everything on dreamweaver so difficult ??