Nifty onClick and onRelease fires at same time when holding down finger


Im making a button in nifty using the image element. So I need onClick and onRelease to work.

Sadly they fire both at once, it does not wait for a release. What onrelease does is wait for second click, and fire before that.

So I’m not sure what I’m suppose to do.

My xml screen looks like this:

[xml] <screen id=“controlpanel” controller=“gui.GuiListener”>

<layer id=“layer2” childLayout=“vertical”>

<panel id=“boost” childLayout=“center” align=“right” height=“100%” width=“40%”>

<image id=“boost_button” filename=“assets/textures/boost_button_up.png” height=“100”

width=“100” valign=“bottom” align=“right” visibleToMouse=“true”>

<interact onPrimaryClick=“boostDown()” onPrimaryRelease=“boostUp()” />


<onStartScreen name=“move” timeType=“exp” factor=“3.5”

direction=“right” mode=“in” length=“300” inherit=“true” />

<onEndScreen name=“move” timeType=“exp” factor=“3.5”

direction=“right” mode=“out” length=“300” inherit=“true” />






My two methods are here:

[java]public final void boostDown(){

Log.d(“shit”, “boost down”);


Element e = MainGame.getNiftyElement(“controlpanel”, “boost_button”);

NiftyImage img = MainGame.getNifty().getRenderEngine().createImage(“textures/boost_button_down.png”, false);



public final void boostUp(){

Log.d(“shit”, “boost up”);


Element e = MainGame.getNiftyElement(“controlpanel”, “boost_button”);

NiftyImage img = MainGame.getNifty().getRenderEngine().createImage(“textures/boost_button_up.png”, false);



Whereas the boost method only sets a boolean on the rocket.

NOTE: Even if I remove the change image stuff from the methods, it will act the same.

Does it have to do with android not being able to send onrelease in 2.2?

I’m running this for all 2.2 devices, tho I myself use a 2.3.