You question goes in a few circles, but I think I get what you want.
You can use framelabels for this and either an enterframe to check what the current framelabel is for the current frame. Or you can add a framescript to the frames you want to know about.
EnterFrame:
Add labels to the frames you know to know about in the timeline. Maybe name the framelabels something like "roll_start", "roll_end" etc.
then use an enterframe to test if you are on a frame that you are interested in like so:
addEventListener(Event.ENTER_FRAME, enterFrameHandler);
private function enterFrameHandler(e:Event):void {
if (currentLabel == 'roll_start') {
// Rollover started
} else if (currentLabel == 'roll_end') {
// Rollover ended
}
}
FrameScript:
Use the undocumented frameScript method to add a script that dispatches a custom bubbled Event on the frames of interest, then just listen for that event, rather than listening for enterframe and checking every frame:
private static const TIMELINE_AT_LABEL:String = 'timelineAtLabel';
function frameScript():void {
dispatchEvent(new Event(TIMELINE_AT_LABEL, true, true));
}
var rollStartFrame:int = 10;
var rollEndFrame:int = 20;
addFrameScript(rollStartFrame, frameScript);
addFrameScript(rollEndFrame, frameScript);
addEventListener(TIMELINE_AT_LABEL, atLabelHandler);
private function atLabelHandler(e:Event):void {
var frame:int = e.target.currentFrame;
if (frame == rollStartFrame) {
// Rollover started
} else if (frame == rollEndFrame) {
// Rollover ended
}
}