View Full Version : Release Outside Mouse Event
sa6k0o0
12-07-2006, 05:54 PM
In flex2 and as3 onReleaseOutside is no longer available and has to be somehow simulated. Does anyone has an idea how to do that ?
I have a button and I need to get the event mouseUp if the mouse is outside the flex stage , just exactly the same like onReleaseOutside.
(The thing is that I still have never seen how to get the event mouseUp when the mouse is outside the flex stage)
If somebody knows how to do that I will truly appreciate it.
CDHBookingEdge
12-07-2006, 06:51 PM
This might or might not help ;-)
In the Actionscript 2.0 Migration page on livedocs (http://livedocs.macromedia.com/flex/2/langref/migration.html) it has some info and it say the following: Replaced in the new event model by a mouseUp event after a call to flash.display.InteractiveObject.setCapture().
Hope that helps,
Christopher
sa6k0o0
12-07-2006, 07:14 PM
I Tried Everything What Adobe Say's About That But Nothing There Does Work :((((((
CDHBookingEdge
12-07-2006, 08:47 PM
Hmmm...darn!
I just did a bit of checking on FlexSearch.org (http://flexsearch.org/) and saw this:
http://www.dgrigg.com/post/Flex-2-AS-3-onReleaseOutside
See if that give you any leads and maybe you can read on FlexSearch and see if anyone's provided an answer.
Also you might check Jesse's new (lacking a better phrase) FlashSearch (http://www.google.com/coop/cse?cx=015158955796870541905%3Axsxagqtsc3a)
Christopher
sa6k0o0
12-07-2006, 11:26 PM
I have checked that almost a week ago , and I looked everywhere in internet and on the web site of adobe and on hundreds of others web sites how to do that,but unfortunately there is no way :(
If you take a look more carefully on http://www.dgrigg.com/post/Flex-2-AS-3-onReleaseOutside
you will see that if you hold the first button on some of the rectangles it starts dragging and if you move the mouse outside the flash file in the browser and if you release the mouse button , it is supposed to release the rectangle? right ?
because the mouse is already up , right ?
but it doesn't work :(
and when you move the mouse again back to the flash in the browser , even though the no mouse button is being holed it will behave like you are currently still in mouse down. This is a bug, it is not supposed to be like that.
The only solution I found for what I need and it is not on the way I want it is to look all the time for the mouse and when it gets outside of the stage to simulate something like mouseReleaseOutside but it is not the best way. In actionscrpt 2 it is a lot more simple.
CDHBookingEdge
12-08-2006, 07:57 AM
Hmm I'm probably missing something here, but .. you said:
If you take a look more carefully on http://www.dgrigg.com/post/Flex-2-AS-3-onReleaseOutside
you will see that if you hold the first button on some of the rectangles it starts dragging and if you move the mouse outside the flash file in the browser and if you release the mouse button , it is supposed to release the rectangle? right ?
because the mouse is already up , right ?
I tried (at least I think I did) exactly what you said and it did for the red but not for the green. Which is what the demo was trying to show. Here's what I did
1) Mouse down on red square
2) Move it back and forth
3) Move upward till outside of the flash applet area
4) Release mouse
5) Move mouse back into flash applet area
6) Move it around with mouse still in "up position"
And the red rectangle did not move. But, if the green rectangle was used in the above then it did move upon re-entry into the flash applet, again as the demo is designed to demonstrate.
So I seem to be seeing the expected behaviour. Therefore I'd have to say "Yes right" to both of your questions. And that's what I saw.
So am I missing something here or seeing totally different behavior or what?
Senocular it looks like actually gave the idea of using the stage instead of the application. Maybe he could shed some additional light on this one.
Christopher
when the button is clicked, add a listener to the stage for MOUSE_UP. Once caught remove it.
CDHBookingEdge
12-08-2006, 12:52 PM
Just wondering so I'm not confused if and when I need to do something like this. Isn't that what the does? I mean is the sample there operating incorrectly or correctly?
Thanks Tink, in advance,
Christopher
sa6k0o0
12-08-2006, 08:00 PM
CDHBookingEdge, I do the exact same thing , but step 3) Move upward till outside of the flash applet area , I move it not just in the gray space behind the rectangles, but really far away from the applet, and than it flash doesn't get the event for mouseUP for any of the rectangles , when it is outside from the stage.
But if you move the mouse a little but out, so that it is still in the applet but in the gray area than the behavior will be on the way you describe it with the difference of catching the mouseUp event for the rectangles.
heres an example<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
creationComplete="onCreationComplete( event );">
<mx:Script>
<![CDATA[
import mx.core.UIComponent;
import mx.events.FlexEvent;
private var _sprite:UIComponent;
private function onCreationComplete( event:FlexEvent ):void
{
_sprite = new UIComponent();
drawRectangle( 0xFF0000 );
_sprite.addEventListener( MouseEvent.MOUSE_DOWN, onSpriteMouseDown );
addChild( _sprite );
}
private function onSpriteMouseDown( event:MouseEvent ):void
{
drawRectangle( 0x0000FF );
stage.addEventListener( MouseEvent.MOUSE_UP, onMouseUp );
}
private function onMouseUp( event:MouseEvent ):void
{
stage.removeEventListener( MouseEvent.MOUSE_UP, onMouseUp );
drawRectangle( 0xFF0000 );
}
private function drawRectangle( color:Number ):void
{
_sprite.graphics.clear();
_sprite.graphics.beginFill( color, 1 );
_sprite.graphics.drawRect( 0, 0, 20, 20 );
_sprite.graphics.endFill();
}
]]>
</mx:Script>
</mx:Application>
http://www.tink.ws/asorg/ReleaseOutside.html
CDHBookingEdge
12-09-2006, 07:28 PM
Ok, but again was the sample at http://www.dgrigg.com/post/Flex-2-AS-3-onReleaseOutside not doing the same thing? I'm just trying to make sure for my own understanding as much as anyones that really what you're recommending (quite correctly) is what the aforementioned sample is doing? I'm just trying to make sure I'm not missing a subtlety that you're presenting.
i'm not quite sure of the question bud?
CDHBookingEdge
12-10-2006, 02:41 PM
I guess I'm asking did you take a look at the code presented in the link above and find that there was a "bug" in it? Or did you just present an example to simplify the problem.
As far as I'm seeing it, you're both right. ;-) Meaning both your sample and the sample in that link. I just want to make sure I'm not (LOL) deluding myself as far as the other sample.
I've got 2 if not 3 projects on my plate where this kind of thing is going to probably be done pretty heavily so I just wanted to make sure I have it right in my head. ;-)
Thanks in advance,
Christopher
for ome reason the example doesn't show fully in safari, but i wuld guess its pretty much the same. I posted an example cos i thought i'd read that it wasn't working for someone when the have moved out of the flash applet.
CDHBookingEdge
12-10-2006, 03:07 PM
Ok cool so sounds like maybe it was and just had some problems with different browsers. LOL Ok so I'm not fooling myself then. ;-) Phew thanks Tink! (BTW yours was much simpler and too the point. LOL)
Christopher
sa6k0o0
12-11-2006, 05:35 PM
that is very strange, when I try the example in firefox on mac os it doesn't work on the right way, when I try it in safari it works.
dgrigg
12-18-2006, 12:42 AM
I
If you take a look more carefully on http://www.dgrigg.com/post/Flex-2-AS-3-onReleaseOutside
you will see that if you hold the first button on some of the rectangles it starts dragging and if you move the mouse outside the flash file in the browser and if you release the mouse button , it is supposed to release the rectangle? right ?
because the mouse is already up , right ?
but it doesn't work :(
and when you move the mouse again back to the flash in the browser , even though the no mouse button is being holed it will behave like you are currently still in mouse down. This is a bug, it is not supposed to be like that.
If you read the post closely, you will read that the green box is set to not have a release outside event while the red box does, in order to show the difference.
The green box behaves without a release outside event, so it exhibits the behavior of continuing to follow the mouse after a release out side, Flex's default behavior without the extra code. The red box behaves properly, it has a release outside event, releasing the drag on the mouse up outside of the light grey rectangle, or completely outside of the swf properly ends the dragging event. That sample works properly in both IE and Firefox, I have not tried it in Safari.
Derrick
------------
Derrick Grigg
www.dgrigg.com
sa6k0o0
12-18-2006, 09:41 PM
It works correctly on windows with firefox and IE, it works on the right way also on Mac OS using Safari, but it doesn't work on Mac OS using firefox 2.0 !
dgrigg
12-19-2006, 09:54 PM
It works correctly on windows with firefox and IE, it works on the right way also on Mac OS using Safari, but it doesn't work on Mac OS using firefox 2.0 !
Must be an issue with the plugin. I have seen other weird things happen before with the Mac plugin. How exactly does it not work?
sa6k0o0
12-20-2006, 07:10 PM
When I make make mouseUp outside the flash stage, flash doesn't recognize the mouseUp , and this problem is only on mac os x using firefox 2.0
CoreyL
06-05-2007, 11:52 PM
After much trouble, finally came across a permutation of events that help with this problem. Check out this post (http://www.justsuppose.com/2007/06/as3flash-9firefox-mouse-capture-bug.html) for an explanation.
Regards,
C
knovak
07-03-2008, 08:57 PM
So, working with multiple layers here folks.
Already have a stage listener in the parent.swf so that interior files can be developed by multiple designers.
Any way to listen for a mouse_up event without flash breaking because there are other listeners on the stage?
robmccardle
10-16-2008, 02:03 PM
I posted about this in AS3 and put source code up here:
http://www.robmccardle.com/wp/?p=33
It's a Flash Develop project but principle is the same in Flash/Flex ;)
Rob
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.