Re: [Flashcoders] Re: simulating mouse clicks
So I was able to get this to work for a large majority of cases by handling the following special cases: 1) Clicking a row in a List, code snippet: listObj.selectedIndex = theObjToClick.__dataIdx; listObj.dispatchEvent( {type:change, target:listObj, name:change} ); 2) Clicking a Menu item, code snippet: menuObj.onRowRelease(theObjToClick.__dataIdx); The __dataIdx property indicates the index in the data provider array that 'theObjToClick' corresponds to. For all other types of objects, invoke onPress/onRelease on theObjToClick. I got the key insights here from the source code for an open source tool called 'AutoTestFlash' (http://tiago.webstartpoint.net/flash/). This is working for me so far without limitations, although I would not call it generic without further testing. -- Vishal On 10/20/06, Kevin Aebig [EMAIL PROTECTED] wrote: I'm assuming that you have something other than the pointer acting like it has control in the same way as the cursor. I've done this before for some specific circumstances and it required hit collision detection and checking for every possible scenario. - Check for onPress and onRelease and onClick (custom handler) - Check for dispatchEvent - Add either a listener to the mouse, or to UIEventDispatcher It's not a complete solution, but generally it should take care of a lot of circumstances. !k -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Vishal Kapur Sent: Thursday, October 19, 2006 12:16 PM To: Flashcoders mailing list Subject: [Flashcoders] Re: simulating mouse clicks I'll ask the question a different way: what are all the ways that a mouse click event can be handled in a flash movie? (other than defining an onPress/onRelease callback) -- Vishal On 10/17/06, Vishal Kapur [EMAIL PROTECTED] wrote: I'm trying to solve the problem of generically simulating mouse clicks in a running flash movie. So, I'd like to be able to write a function that when invoked with the targetPath of the flash object to be clicked, would be able to simulate a mouse click on that object as if a user had actually clicked it. I should also mention that the technique needs to work with arbitrary 3rd-party flash movies (so I don't have control to change the code). The simplest thing to try is just to try to invoke the onPress/onRelease callbacks on the target object. This works sometimes. However, in some cases it doesn't quite simulate a real mouse click. In particular, I seem to have trouble simulating clicks on components (in a List component, for example, the selected row will get highlighted but the handler that does further processing and refreshes the UI doesn't seem to get called). Currently I am (sort of) working around this by getting the coordinates of the center of the target object and using the Win32 api's to move the mouse pointer and simulate the windows mouse down/up events. As you can imagine this is not truly generic (doesn't handle scrollbars, movielclips obscured by other objects, etc). Any thoughts on this? Anyone with previous experience with this or ideas on a better way to generically simulate a click event in flash? Thanks, Vishal ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
RE: [Flashcoders] Re: simulating mouse clicks
I'm assuming that you have something other than the pointer acting like it has control in the same way as the cursor. I've done this before for some specific circumstances and it required hit collision detection and checking for every possible scenario. - Check for onPress and onRelease and onClick (custom handler) - Check for dispatchEvent - Add either a listener to the mouse, or to UIEventDispatcher It's not a complete solution, but generally it should take care of a lot of circumstances. !k -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Vishal Kapur Sent: Thursday, October 19, 2006 12:16 PM To: Flashcoders mailing list Subject: [Flashcoders] Re: simulating mouse clicks I'll ask the question a different way: what are all the ways that a mouse click event can be handled in a flash movie? (other than defining an onPress/onRelease callback) -- Vishal On 10/17/06, Vishal Kapur [EMAIL PROTECTED] wrote: I'm trying to solve the problem of generically simulating mouse clicks in a running flash movie. So, I'd like to be able to write a function that when invoked with the targetPath of the flash object to be clicked, would be able to simulate a mouse click on that object as if a user had actually clicked it. I should also mention that the technique needs to work with arbitrary 3rd-party flash movies (so I don't have control to change the code). The simplest thing to try is just to try to invoke the onPress/onRelease callbacks on the target object. This works sometimes. However, in some cases it doesn't quite simulate a real mouse click. In particular, I seem to have trouble simulating clicks on components (in a List component, for example, the selected row will get highlighted but the handler that does further processing and refreshes the UI doesn't seem to get called). Currently I am (sort of) working around this by getting the coordinates of the center of the target object and using the Win32 api's to move the mouse pointer and simulate the windows mouse down/up events. As you can imagine this is not truly generic (doesn't handle scrollbars, movielclips obscured by other objects, etc). Any thoughts on this? Anyone with previous experience with this or ideas on a better way to generically simulate a click event in flash? Thanks, Vishal ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
[Flashcoders] Re: simulating mouse clicks
I'll ask the question a different way: what are all the ways that a mouse click event can be handled in a flash movie? (other than defining an onPress/onRelease callback) -- Vishal On 10/17/06, Vishal Kapur [EMAIL PROTECTED] wrote: I'm trying to solve the problem of generically simulating mouse clicks in a running flash movie. So, I'd like to be able to write a function that when invoked with the targetPath of the flash object to be clicked, would be able to simulate a mouse click on that object as if a user had actually clicked it. I should also mention that the technique needs to work with arbitrary 3rd-party flash movies (so I don't have control to change the code). The simplest thing to try is just to try to invoke the onPress/onRelease callbacks on the target object. This works sometimes. However, in some cases it doesn't quite simulate a real mouse click. In particular, I seem to have trouble simulating clicks on components (in a List component, for example, the selected row will get highlighted but the handler that does further processing and refreshes the UI doesn't seem to get called). Currently I am (sort of) working around this by getting the coordinates of the center of the target object and using the Win32 api's to move the mouse pointer and simulate the windows mouse down/up events. As you can imagine this is not truly generic (doesn't handle scrollbars, movielclips obscured by other objects, etc). Any thoughts on this? Anyone with previous experience with this or ideas on a better way to generically simulate a click event in flash? Thanks, Vishal ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Re: simulating mouse clicks
Hi, what you wanna do is to send Windows messages, this is not supported in flash, and I know nothing of a workaround. Sorry Yehia On 10/19/06, Vishal Kapur [EMAIL PROTECTED] wrote: I'll ask the question a different way: what are all the ways that a mouse click event can be handled in a flash movie? (other than defining an onPress/onRelease callback) -- Vishal On 10/17/06, Vishal Kapur [EMAIL PROTECTED] wrote: I'm trying to solve the problem of generically simulating mouse clicks in a running flash movie. So, I'd like to be able to write a function that when invoked with the targetPath of the flash object to be clicked, would be able to simulate a mouse click on that object as if a user had actually clicked it. I should also mention that the technique needs to work with arbitrary 3rd-party flash movies (so I don't have control to change the code). The simplest thing to try is just to try to invoke the onPress/onRelease callbacks on the target object. This works sometimes. However, in some cases it doesn't quite simulate a real mouse click. In particular, I seem to have trouble simulating clicks on components (in a List component, for example, the selected row will get highlighted but the handler that does further processing and refreshes the UI doesn't seem to get called). Currently I am (sort of) working around this by getting the coordinates of the center of the target object and using the Win32 api's to move the mouse pointer and simulate the windows mouse down/up events. As you can imagine this is not truly generic (doesn't handle scrollbars, movielclips obscured by other objects, etc). Any thoughts on this? Anyone with previous experience with this or ideas on a better way to generically simulate a click event in flash? Thanks, Vishal ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Re: simulating mouse clicks
Other than onPress/Release you can try onMouseDown / HitTest combination. It's not quite clear what you're trying to do though. or maybe i'm reading it in dumb mode right now. On 10/19/06, Yehia Shouman [EMAIL PROTECTED] wrote: Hi, what you wanna do is to send Windows messages, this is not supported in flash, and I know nothing of a workaround. Sorry Yehia On 10/19/06, Vishal Kapur [EMAIL PROTECTED] wrote: I'll ask the question a different way: what are all the ways that a mouse click event can be handled in a flash movie? (other than defining an onPress/onRelease callback) -- Vishal On 10/17/06, Vishal Kapur [EMAIL PROTECTED] wrote: I'm trying to solve the problem of generically simulating mouse clicks in a running flash movie. So, I'd like to be able to write a function that when invoked with the targetPath of the flash object to be clicked, would be able to simulate a mouse click on that object as if a user had actually clicked it. I should also mention that the technique needs to work with arbitrary 3rd-party flash movies (so I don't have control to change the code). The simplest thing to try is just to try to invoke the onPress/onRelease callbacks on the target object. This works sometimes. However, in some cases it doesn't quite simulate a real mouse click. In particular, I seem to have trouble simulating clicks on components (in a List component, for example, the selected row will get highlighted but the handler that does further processing and refreshes the UI doesn't seem to get called). Currently I am (sort of) working around this by getting the coordinates of the center of the target object and using the Win32 api's to move the mouse pointer and simulate the windows mouse down/up events. As you can imagine this is not truly generic (doesn't handle scrollbars, movielclips obscured by other objects, etc). Any thoughts on this? Anyone with previous experience with this or ideas on a better way to generically simulate a click event in flash? Thanks, Vishal ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com