Hi,
I’m trying to trigger an nifty effect from java.
Something like this:
[xml]
<effect>
<panel id=“JuegoPanelJug1” height=“90%” width=“50%” backgroundImage=“Interface/Imagenes/Pantalla 4. Juego/Panel Jugador Izquierda - V.0.1.png” align=“left” valign=“center” childLayout=“horizontal”>
<effect>
<onStartScreen name=“move” mode=“toOffset” offsetX="-${CALL.getScreenWidht()}" length=“1000” startDelay=“0” neverStopRendering=“true”/>
<onCustom customKey=“onHide” name=“hide” tartegElement=“JuegoPanelJug1” length=“0” startDelay=“0” neverStopRendering=“true”/>
</effect>
</panel> [/xml]
The java code:
[java] List<Effect> moveEffects = nifty.getScreen(“Juego”).findElementByName(“JuegoPanelJug1”).getEffects(EffectEventId.onCustom, Hide.class);
moveEffects.get(0).start(moveEffects.get(0).getAlternate(), moveEffects.get(0).getCustomKey());
[/java]
I’ve try a differents things but with no success.
I have looked for examples but I can’t find anything that help me.
Where is the problem?
Is there any example that I can follow about this topic?
Thanks,
I’m a bit confused by your code, but the correct way to start a nifty effect from java is (the Custom effect in this case):
[java]yourElement.startEffect(EffectEventId.onCustom);[/java]
1 Like
Thanks rickard.
Now it’s working fine. The code is this
[java] nifty.getScreen(“Juego”).findElementByName(“JuegoPanelJug1”).startEffectWithoutChildren(EffectEventId.onCustom, null, “onHide”);[/java]