TextCreator and addEffectsOnActive()


After the post http://hub.jmonkeyengine.org/groups/gui/forum/topic/progressive-text/ from danath, I try to use the effect inside one of my GUI.

When I add it on XML side, it works correctly


<label text=“HELLO NIFTY WORLD” align=“left” textHAlign=“left”>


<onActive name=“textTyping” length=“5000” /> <!-- it should take 5000 ms to show the whole text one character after the other -->




But when I try to add it on JAVA side, the effect isn’t triggered :


TextCreator textCreator;

textCreator = new TextCreator( text );

textCreator.setFont( “textDialog.fnt” );

textCreator.setWidth( “100%” );

textCreator.setHeight( “100%” );

textCreator.setTextHAlign( “center” );

textCreator.setTextVAlign( “top” );

ControlEffectAttributes activeEffect = new ControlEffectAttributes();

activeEffect.setName( “textTyping” );

activeEffect.setAttribute(“length”, String.valueOf( text.length() * 200 ) );

textCreator.addEffectsOnActive( activeEffect );

SheetManager.addTask( new PanelCleaner( screen, textPanel ));

SheetManager.addTask( new CustomElementCreator( nifty, screen, textPanel, textCreator ));


I don’t know really why but it seems the onActive effect may be the souce of the problem.

( I think I heard somewhere that the onActive effect will be replaced by some onCustomEffect in Nifty 1.3 for classic controls )

Does anyone know if my asumptions are correct ( I’m still on nifty1.2 )

Thanks in advance :slight_smile:

just tried it with 1.3 and it works - well, I don’t have all of your code and I tried it with the Move effect only so I’m not sure what might cause the issue in your case :slight_smile:

can you try to screen.debugOutput() everything and then check if the onActive effect is correctly attached to the element?

I’m not sure what you’ve heard but onActive is still in 1.3 as well as onCustomEffect :slight_smile:

I was checking the late controls for checkboxes and it appeared that all effect had been moved to customControls instead of onActive.

With that in mind I saw other posts dealing with onCustom effect and it seems I’ve drawn a conclusion by myself without realizing it :slight_smile:

My textTyping effect is in fact yours xD

I copied the one you gave as an example on this forum ( When text comes when time flows by )

I will add the link to the original post later ( for now, I’m on an internet cafe because I ;oved out and my new house doesn’t have internet yet )