Is it possible to dynamically attach action scripts to specified frames in an mc's timeline?

Here's an example of what I am trying to achieve:

I'm creating a component which will initially loop through all of the frames of an mc specified in the clip parameters. I'd like to assign a function call to certain frames on the timeline during this loop. I'd prefer to set it up this way than too keep checking the mc's current frame using an onEnterFrame callback.