Action that hide certain layer?

suppose i have 2 frames (a & b) with 2 layers, is there any action or method that can hide layer 1 in frame a but hide layer 2 in frame b?

thanks