Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Highlighted
Contributor
Posts: 48
Registered: ‎09-08-2013
My Device: Z10
My Carrier: None

slow game play and game freeze when touching screen

[ Edited ]

I hate to sound like the **bleep** in the room but I just worked up an arcade style game but whenever you touch the BlackBerry Z10 screen, the game goes half speed. If you move your finger constantly, the game stops playing completely. Releasing your finger makes the game continue as usual.

 

I've tried both:

 

stage.addEventLIstener(MouseEvent.CLICK, dothis);

 

function dothis(e:MouseEvent):void{

stage.removeEventListener(MouseEvent.CLICK, dothis);

[code}

}

 

and:

 

addEventListener(MouseEvent.CLICK, dothis);

 

function dothis(e:MouseEvent):void{

removeEventListener(MouseEvent.CLICK, dothis);

[code}

}

 

but neither solves the problem. I have other apps that have MouseEvent LIsteners on the root without any problem at all but for some reason this app behaves the way I"ve described.

 

I started with MOUSE_DOWN and MOUSE_UP so that the avatar holds a state while the player touches the screen and then changes when the player releases. I thought the DOWN and UP listeners were the problem but changing to CLICK didn't help either, except my finger not being on the screen helps the gameplay not glitch with the slightest movement of my finger.

 

Also, TOUCH_TAP doesn't help using MultitouchInput.

Retired
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: slow game play and game freeze when touching screen

It is possible to get 60 FPS in AIR. Do you have any other event listeners in your app for interaction? I'm curious where the CPU is getting the most demand from.

 

The Click should only be fired when you remove your finger from the screen, not while you have it held down.

 

Does your app use bitmaps?  If you are caching bitmaps, know that they get loaded into the gpu ever frame while the finger is down.

 

 

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.