Got it.
Here is a simple demo.
Preview:
https://bit.ly/3sn7O0y
JS code:
var root = this;
var targetMC = root;
var currentRadio = root.radio0;
root.main = function()
{
stage.mouseMoveOutside = true;
createjs.Touch.enable(stage);
root.stop();
root.controlMC(targetMC);
root.radio0.gotoAndStop(1);
root.radio0.on("click", root.chooseRadio, root, false, { target: root });
root.radio1.on("click", root.chooseRadio, root, false, { target: root.anim });
stage.on("stagemousemove", root.stageMouseMoveHandler);
};
root.chooseRadio = function(e, data)
{
if (currentRadio)
currentRadio.gotoAndStop(0);
e.currentTarget.play();
currentRadio = e.currentTarget;
targetMC = data.target;
targetMC.loop = false;
root.controlMC(targetMC);
};
root.stageMouseMoveHandler = function()
{
root.controlMC(targetMC);
};
root.controlMC = function(mc, width)
{
var point = mc.globalToLocal(stage.mouseX, stage.mouseY);
var width = mc === exportRoot ? lib.properties.width : mc.nominalBounds.width;
var mouseXRatio = point.x / width;
mc.gotoAndStop(Math.floor(mc.totalFrames * mouseXRatio));
};
if (!this.started)
{
root.main();
this.started = true;
}
I added the an interactivity to control the current timeline that is being controlled but you can ignore it and just pick what you need.
FLA / files / source:
https://github.com/joao-cesar/adobe/tree/master/animate%20cc/html5_canvas/change_timeline_according_to_mouse_cursor
I hope it helps.
Regards,
JC