Newgrounds.com — Everything, By Everyone.

Checking login status…

USERNAME:

PASSWORD:

Logging in…

Logged in as:
.
Logging out…
Inbox My Account Log Out


Forum Topic: Flash Mouse Lag?

(134 views • 5 replies)

This topic is 1 page long.

<< < > >>
Resigned

Kajenx

Reply To Post Reply & Quote

Posted at: 6/2/08 02:19 AM

Kajenx DARK LEVEL 14

Sign-Up: 12/01/06

Posts: 552

So I'm working on a game with some intense graphics, and it seems like the mouse input starts lagging way before the framerate starts dropping. I have a custom cursor that is supposed to follow the mouse, but when I really whip it around and there's a lot of movieclips moving around on the stage, it lags behind a frame or two.

Here's the code:

addEventListener(MouseEvent.MOUSE_MOVE,CursorFunction);

...

private function CursorFunction(event:MouseEvent):void {
	// Mouse
	Mouse.hide()
	Cursor.x = mouseX;
	Cursor.y = mouseY;
	event.updateAfterEvent();
}

I noticed this when I was making Ether Cannon too. It's weird because the framerate is nice and constant (and everything is moving around smoothly). The custom cursor is the only thing that lags.

Any ideas? Maybe I should email Adobe and yell at them.

BBS Signature

None

GuyWithHisComp

Reply To Post Reply & Quote

Posted at: 6/2/08 04:56 AM

GuyWithHisComp LIGHT LEVEL 23

Sign-Up: 11/10/05

Posts: 4,029

At 6/2/08 02:19 AM, Kajenx wrote: event.updateAfterEvent();

You know what that function does right?

It redraws the screen every event. So if your event triggers too much, obviously it will lag.

BBS Signature

None

Kajenx

Reply To Post Reply & Quote

Posted at: 6/3/08 01:54 AM

Kajenx DARK LEVEL 14

Sign-Up: 12/01/06

Posts: 552

At 6/2/08 04:56 AM, GuyWithHisComp wrote:
At 6/2/08 02:19 AM, Kajenx wrote: event.updateAfterEvent();
You know what that function does right?

It redraws the screen every event. So if your event triggers too much, obviously it will lag.

I added that on with the hopes that it would speed up the response time. I was doing the same thing without it though.

I think it's just a problem with the flash player, to be honest. It probably has input events as a lower priority than rendering the graphics.

BBS Signature

None

sspecter

Reply To Post Reply & Quote

Posted at: 6/3/08 04:11 AM

sspecter DARK LEVEL 11

Sign-Up: 09/28/05

Posts: 387

Just increase the framerate and avoid framerate lags.

There is no such thing as "mouse lagging before framerate". Unless your AS is broken, the cursor should update it's position at each frame. If the framerate lags, then obviously the mouse will lag, there is no way around it.


None

Kajenx

Reply To Post Reply & Quote

Posted at: 6/3/08 09:33 PM

Kajenx DARK LEVEL 14

Sign-Up: 12/01/06

Posts: 552

At 6/3/08 04:11 AM, sspecter wrote: Just increase the framerate and avoid framerate lags.

There is no such thing as "mouse lagging before framerate". Unless your AS is broken, the cursor should update it's position at each frame. If the framerate lags, then obviously the mouse will lag, there is no way around it.

Bah, that goes against what I've witnessed. You're obviously an impostor from Adobe, don't feed me your lies. :D

BBS Signature

None

Woadraiders

Reply To Post Reply & Quote

Posted at: 6/3/08 09:56 PM

Woadraiders DARK LEVEL 09

Sign-Up: 11/11/07

Posts: 359

Why can't you just use startDrag..?

My blog-ish thing.
Workin' on games. For Whom the Bell Tolls.. It Tolls for Thee

BBS Signature

All times are Eastern Daylight Time (GMT -4) | Current Time: 10:16 PM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!