Swapping instances in a symbol with code,is it possible?

I have a movie clip called A that contains instance A1.
Is it possible to swap to instance A2 using code?
Thank you.