Is there a way to gotoAndPlay on buttons?

I am now dealing with buttons and have to create them with this kind of flow:

I need to click the coloured buttons and store them into array.
When I click play button, the color buttons have to play in sequence according to the array.

In the buttons i did insert keyframe to make the code such as,


But it doesn’t work.

Anyone have any way or suggested solution for me?
Thanks alot for the help in advance…