On Sep 8, 12:14 pm, Brock H <
brock.hayw...@gmail.com> wrote:
> Hi there,
>
> I'm working on a very simple looped fade effect that just fades out an
> image, inverts the effect, and fades it in, and so on. I'm running
> into a problem that after the second call to inverting the effect, the
> image flickers and the starts over again.
>
I ran into that flicker thing too, so instead of using the "loop"
feature, I used two fade effects, one regular, and one with opaque
settings to give an inverse fade. (Maybe using fade2.inverse() would
have worked just as well). In any case, I have two interrupt
handlers; at the end of each effect, the interrupt handler plays the
other effect. Seems to give a smooth fade in, fade out, without
flicker.
fade1 = new Fade(vp1.getElement());
fade1.setDuration(4);
fade2 = new Fade(vp1.getElement());
fade2.setStartOpacity(0);
fade2.setEndOpacity(100);
fade1.play(); // need this to kick start the
effects
fade1.addEffectCompletedHandler(new EffectCompletedHandler(){
public void onEffectCompleted(EffectCompletedEvent evt){
fade2.play();
}
});
fade2.addEffectCompletedHandler(new EffectCompletedHandler(){
public void onEffectCompleted(EffectCompletedEvent evt){
fade1.play();
}
});