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

Hi,



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()” />



<effect>

<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” />

</effect>

</image>

</panel>

</layer>

</screen>[/xml]



My two methods are here:

[java]public final void boostDown(){

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

AndroidDashActivity.onBoost(true);

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

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

e.getRenderer(ImageRenderer.class).setImage(img);

}



public final void boostUp(){

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

AndroidDashActivity.onBoost(false);

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

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

e.getRenderer(ImageRenderer.class).setImage(img);



}[/java]

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.