jsfl 将库中声音放置到时间轴上

时间:2024-11-03 10:37:02
setBrokenFrames("cz1.mp3",2);
/**/
/*<--------------将库中声音放置到时间轴上------------->*/
/**
_Name 库声音名称
_Length 时间轴上的第几帧
**/
function setBrokenFrames(_Name, _Length) {
var broken;
if (fl.getDocumentDOM().library.itemExists(_Name)) {
//选帧
fl.getDocumentDOM().getTimeline().setSelectedFrames(0, _Length);
//使用convertToBlankKeyframes方法注意,指定帧上面有空白帧,会自动延伸一帧
fl.getDocumentDOM().getTimeline().convertToBlankKeyframes(_Length-1);
fl.getDocumentDOM().getTimeline().setFrameProperty('soundName', _Name);
fl.getDocumentDOM().getTimeline().layers[0].frames.soundSync = "stream";
fl.getDocumentDOM().getTimeline().layers[0].frames.soundLoopMode = "repeat";
fl.getDocumentDOM().getTimeline().layers[0].frames.soundLoop = 2;
}
}