Hi David,

Evan, the problem is that he loses the mouse release trigger when he
accually released the button after pressing a key.

I think the solution would be to create a custom
press/release/releaseOutside functionality without using the built in
movieclip methods.

Mouse.addListener(this);
Key.addListener(this);

function onMouseDown() {
//this.hitTest(_xmouse, _ymouse);
trace('mouse down');
}

function onMouseUp() {
trace('mouse up');
}

function onKeyDown() {
trace("DOWN -> "+"\tKey: "+chr(Key.getAscii()));
}

function onKeyUp() {
trace("UP -> "+"\tKey: "+chr(Key.getAscii()));
}

I tested it, holding the mouse down and hitting a key doesn't invoke the
mouse up event. If you're extending a movieclip class then you're already
listening to mouse events so you don't need to add your object as a
listener, otherwise you will be recieving the mouse event twice. The hitTest
method ( that I commented out ) can be used to determine whether your mouse
is over a particular movieclip.

I hope this helps you out.

Good luck,

H

On 11/2/05, Evan <[EMAIL PROTECTED]> wrote:
>
>
> Use Key.isDown(0) to test for just the left button in the onRelease
> function.
>
> btn.onRelease = function() {
> if (Key.isDown(0)) {
> trace('released');
> }
> }
>
> -Evan
>
> David Stiller wrote:
> > Is anyone else seeing this? Draw a shape, convert to button or mc.
> > Code the following:
> >
> > btn.onPress = function() {
> > trace("pressed");
> > }
> > btn.onRelease = function() {
> > trace("released");
> > }
> > btn.onReleaseOutside = function() {
> > trace("released outside");
> > }
> >
> > Click the symbol to see "pressed" in the Output panel. Release, of
> > course, to see "released."
> >
> > Now click again, but hold this time. Now press any key. If you're
> > over the symbol, you'll see "released," even though you haven't; if
> you're
> > not over the symbol, you'll see "released outside," even though you
> haven't.
> >
> > This is a total bummer if you want to write a drawing app with Shift
> > constrain or Ctrl whatever.
> >
> > Anyone know a workaround?
> >
> >
> > David
> > [EMAIL PROTECTED]
> > "Luck is the residue of good design."
> >
> > _______________________________________________
> > Flashcoders mailing list
> > [email protected]
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to