Re: [Flashcoders] No Key.isDown() method in AS3?

2005-12-29 Thread Danny Kodicek

It's a bit scary that Director has a similar problem... how do Director

programmers get around it?

We have the keyPressed() function (equivalent to key.isDown()) :)

Danny


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] No Key.isDown() method in AS3?

2005-12-29 Thread Newsdee
It's a bit scary that Director has a similar problem... how do Director
programmers get around it?


On 12/29/05, Danny Kodicek <[EMAIL PROTECTED]> wrote:

In Director, at least on Windows, if you press the A key and then the B key,
> then release the A key, you get a keyUp event for B, not A. So writing a
> key
> manager without any way to poll the state of individual keys is very
> limited.
>
> Danny
>
>
> ___
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] No Key.isDown() method in AS3?

2005-12-29 Thread Danny Kodicek

It would be not too hard to write a class that listesn to the keyboard, and

when an onKeyDown event is triggered, it reads the key and adds the keycode
to an array.

I can't speak for Flash in this regard, but I'm willing to bet it would 
behave similarly to Director and that this method would be unreliable. (I 
think it's an OS-level problem, in fact). You'd experience several problems 
that would cause your key manage to go out of synch with the key states. 
Most obviously, if the window loses focus, it doesn't receive the key 
events, so it's quite possible to get a keyDown event and not a keyUp (and 
this isn't as rare as you might think: I often have problems when my 
anti-virus scan finishes and pulls me out of the window I'm working in). 
Also, there are problems with keyUp events when multiple keys are pressed. 
In Director, at least on Windows, if you press the A key and then the B key, 
then release the A key, you get a keyUp event for B, not A. So writing a key 
manager without any way to poll the state of individual keys is very 
limited.


Danny


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] No Key.isDown() method in AS3?

2005-12-28 Thread Fumio Nonaka
Adding true to an array at the index of the keycode instead of adding 
the code to it might be better on looking through the array.  Because 
you do not have to use for loop.


Adding:
pressedKeys_array[Key.getCode()] = true;

Looking:
bIsDown = pressedKeys_array[Key.getCode()]
_
Newsdee wrote:

I can see a workaround though:

It would be not too hard to write a class that listesn to the keyboard, and
when an onKeyDown event is triggered, it reads the key and adds the keycode
to an array.

The keycode is then removed at an onKeyUp event. And the isDown method would
just have to look through the array.


Good luck,

Fumio Nonaka
mailto:[EMAIL PROTECTED]
http://www.FumioNonaka.com/
My books
Flash community

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] No Key.isDown() method in AS3?

2005-12-28 Thread hank williams
I would suggest reposting this next week when the adobe people get
back from vacation.

Regards
Hank

On 12/28/05, Joe Cutting <[EMAIL PROTECTED]> wrote:
>  >>
> I was going over the AS3 documentation and I've noticed that the isDown()
> property was "removed for security reasons" from the new Keyboard class.
> Is there another way of doing the same thing then? Are we now forced to use
> the event-driven onKeyDown()?
>
> Here's the page where I'm reading:
> http://livedocs.macromedia.com/labs/1/flex/langref/migration.html
>
>  >>
> If this is correct then it sounds like a real pain and possible
> reason for not using
> Flash altogether. I'm currently using isDown() for all sorts of game
> like applications
> including some which rely on several keys being pressed at once.
> Does anyone know whether the new KeyboardEvent object will let you do this
> and if not how do we go about telling Adobe that there's going to be a 
> problem.
>
> Cheers
>
> Joe
>
> ___
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] No Key.isDown() method in AS3?

2005-12-28 Thread Newsdee
I can see a workaround though:

It would be not too hard to write a class that listesn to the keyboard, and
when an onKeyDown event is triggered, it reads the key and adds the keycode
to an array.

The keycode is then removed at an onKeyUp event. And the isDown method would
just have to look through the array.

Of course this is suboptimal, as it would never be as efficient as a
built-in method to detect the state of a key...



On 12/28/05, Joe Cutting <[EMAIL PROTECTED]> wrote:
>
> If this is correct then it sounds like a real pain and possible
> reason for not using
> Flash altogether. I'm currently using isDown() for all sorts of game
> like applications
> including some which rely on several keys being pressed at once.
> Does anyone know whether the new KeyboardEvent object will let you do this
> and if not how do we go about telling Adobe that there's going to be a
> problem.
>
> Cheers
>
> Joe
>
> ___
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] No Key.isDown() method in AS3?

2005-12-28 Thread Joe Cutting

>>
I was going over the AS3 documentation and I've noticed that the isDown()
property was "removed for security reasons" from the new Keyboard class.
Is there another way of doing the same thing then? Are we now forced to use
the event-driven onKeyDown()?

Here's the page where I'm reading:
http://livedocs.macromedia.com/labs/1/flex/langref/migration.html

>>
If this is correct then it sounds like a real pain and possible 
reason for not using
Flash altogether. I'm currently using isDown() for all sorts of game 
like applications

including some which rely on several keys being pressed at once.
Does anyone know whether the new KeyboardEvent object will let you do this
and if not how do we go about telling Adobe that there's going to be a problem.

Cheers

Joe

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] No Key.isDown() method in AS3?

2005-12-27 Thread Newsdee
Hi all,

I was going over the AS3 documentation and I've noticed that the isDown()
property was "removed for security reasons" from the new Keyboard class.
Is there another way of doing the same thing then? Are we now forced to use
the event-driven onKeyDown()?

isDown() is extremely useful... and usually faster than waiting for a key to
be pressed. :-(

Here's the page where I'm reading:
http://livedocs.macromedia.com/labs/1/flex/langref/migration.html

Thanks,
Newsdee.
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders