Require visiting certain frames before moving forward?

I have a site where I want to restrict the user from moving forward unless they have visited certain pages. So if you visti page 1, 2, & 3, then a button appears that lets you move forward. I have this working using buttons.

See example:

However, I need one or all of them to run the function

checkFramesVisited();

When it hits the frame, not when the button is pressed. (because I have a page that auto forwards when audio is done playing. So if you listen to all the audio and don’t click the button, checkFramesVisited(); doesn’t run.) Does anyone know how I can do this?