I've got the following issue with a actionscript3 project.
I have a group of buttons setup via a class sitting in a holder sprite.
When I rollover one of these buttons I loop through all the buttons in the holder and run tweenlite to tween the alpha to .4 except when the name matches the currently active button.
When I rollout I reset all the buttons back to alpha 1 again via a tweenlite tween.
This works fine in most of the time. the issues i have are as follows:
i have tried using tweengroup but this doesn't seem to help either.
let me know if you need any more details. the code is intergrated into a lot of other stuff which is why i haven't posted it but if needed i can put something together.
thanks.
Josh
IMO, you should create a class for those buttons, that maintains the state internally ... so from outside, you only call two methods, let's say fadeDown
and fadeUp
, on the Buttons ... the Buttons themselves know, what their alhpa is, if there is a tween running etc. ... the will always kill their own tween (or simply continue, if it is the right tween) ... and then start the right animation to get to the right visual representation of their internal state ... you might consider using the state pattern for that matter ... to keep your code clean ... (simply use private classes not to end up having too many files) ...
also, a good thing about this is, that the animation is seperated from the logics, so you can easily reuse the button outside of the context of the logic, and/or change the animation concept (e.g. blur the buttons instead of fading them down) withouth any influence on the logic ...
hope this helps ... ;)
greetz
back2dos