Hi there,
I don't know if it might be better to start a new thread, but this question is
related to porting my code from AS2 to AS3 as suggested in this thread. Can
anyone please help? It is (I think) a simple problem.
I can't get keyboard and mouse events to function properly. KeyBoard events
(KEY_DOWN) don't seem to have any effect while mouse events only work
occasionally. Below is a minimal example. When I run it and press keys and the
mouse (while flash has focus), I occasionaly see "onMouseDown():called",
although it is very random, the number of traces is much fewer than the amount
of actual mouse presses and generelly require at least 2 seconds between
presses to register (although sometimes it does not work even when I wait
longer). Key presses do not result in any traced output.
(I did check wheter the problem perhaps lies with "trace()" by doing someting
in the event-functions, but this is not the case).
Please help somebody!
Thanks
Izak
"
package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.events.KeyboardEvent
import flash.events.MouseEvent
public class HelloWorld extends Sprite {
public function HelloWorld() {
var display_txt:TextField = new TextField();
var i:int;
trace("HelloWorld():called")
display_txt.text = "Hello World!";
addChild(display_txt)
addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown)
addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown)
}
public function onKeyDown(event:KeyboardEvent):void {
trace("onKeyDown():called with "+event.charCode+", "+event.keyCode)
}
public function onMouseDown(event:MouseEvent):void {
trace("onMouseDown():called")
}
}
}
"
----- Original Message ----
From: Niels Wolf <[EMAIL PROTECTED]>
To: Open Source Flash Mailing List <[email protected]>
Sent: Tuesday, August 12, 2008 6:51:33 PM
Subject: Re: [osflash] Am I overlooking any crucial tools?
Re: [osflash] Am I overlooking any crucial tools? @Daren.. Thanks, but we use
our own logging system that has different output options.
On 8/12/08 1:42 PM, "izak marais" <[EMAIL PROTECTED]> wrote:
@Niels: Thanks for clearing up my misunderstanding.
@Daren: With AS2 I had been using a similar custom class to write to the
top-level of the movie; based on that I had completely the wrong idea of what
trace() should do. I'll try using trace() and 'tail' to output to shell and
file; it seems useful.
Original Message ----
From: Darren Cook <[EMAIL PROTECTED]>
To: Open Source Flash Mailing List <[email protected]>
Sent: Tuesday, August 12, 2008 12:51:11 PM
Subject: Re: [osflash] Am I overlooking any crucial tools?
>> When you right-click the debug player you'll see an option there
>> called "Debugger".
>
> Yes, but clicking on that does nothing as far as I can tell. (Perhaps
> it would link to the flex builder debugger if one had that...)
Sorry for the confusion; I just meant as a way to identify that you are
using the debug player. Like you Debugger doesn't actually do anything
for me.
BTW, I have a Logger class that has an option to write to the top-level
of the movie, and hide/show with the D key. It is open source (as soon
as I get around to doing a release); if you want a copy before then let
me know.
Darren
_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org