Skip to main content

Alpha transition: how can I intercept the loop starting point?

1 reply [Last post]
fravalle
Offline
Joined: 2006-11-17

I am unable to to intercept the finishing or the starting of a loop continued infinitely during an alpha transition. I tried to override Alpha.finished(); inserting a custom condition like

if (super.value()==0) //then my check

unfortunately I noticed that Alpha creates floating values not always starting from ZERO, so my check is not always synchronized with the starting loop (some time skips).

How can I intercept the loop? tnx

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
chrismcband
Offline
Joined: 2006-07-10

I don't think there is any guarantee that the alpha will fire exactly at zero or at the end. It is only based on elapsed time and subject to inaccuracies.
What I did in when I needed to know my alpha values was to override the processStimulus and check the alpha value. I added some functionality to add alpha listeners to the behavior so I could be informed of alpha changes.

private float alpha;
public void processStimulus(Enumeration criteria){
super.processStimulus(criteria);
if (!getAlpha().finished() || alpha!= getAlpha().value())
notifyAlphaListeners(getAlpha().value());
alpha = getAlpha().value();
}