The probably better option would be to extend on LittleStain's code would be:
pick all objects - set animation to "plain"
pick nearest object
object's animation name <> (not equal) "shine" " - set animation to "shine"
This way it only set's it to shine, if it's not already shining.
You can even take it further and lower the amount of computation C2 has to do, considering most of the times the nearest object doesn't change (this would only do stuff, when another sprite becomes the nearest object):
localvar = 0
pick nearest object
object's animation name <> (not equal) "shine":
-- set object's animation to "shine"
-- set localvar = object.UID
*(subevent of this one) pick all objects
object.animationname = "shine"
object.UID <> (not equal) localvar: set animation to "plain"