var dom = fl.getDocumentDOM(); // AScript definition function AScript(code, timeline, layer, frame, isScene){ this.code = code; this.timeline = timeline; this.layer = layer; this.frame = frame; this.isScene = isScene; this.id = "script:"+this.timeline+"."+this.layer+"."+this.frame; this.title = AScript.timelines[this.timeline].name+': '+AScript.timelines[this.timeline].layers[this.layer].name+', frame '+(this.frame + 1); } AScript.prototype.toString = function(){ return this.code; } AScript.scripts = new Array(); AScript.timelines = new Array(); AScript.addScript = function(code, timeline, layer, frame, isScene){ AScript.scripts.push(new AScript(code, timeline, layer, frame, isScene)); } function parseCode() { // main timeline timelines var sceneCount = dom.timelines.length; AScript.timelines = AScript.timelines.concat(dom.timelines); // library timelines var items = dom.library.items; var n = items.length; var i = 0; while (i < n){ if (items[i].itemType == "movie clip") { AScript.timelines.push(items[i].timeline); } i++; } // get code var li, fi; var ln, fn; var as; var n = AScript.timelines.length; var i = 0; while (i < n) { ln = AScript.timelines[i].layers.length; li = 0; while (li < ln) { fn = AScript.timelines[i].layers[li].frames.length; fi = 0; while (fi < fn) { as = AScript.timelines[i].layers[li].frames[fi].actionScript; if (as) { AScript.addScript(as, i, li, fi, (i < sceneCount)); } fi += AScript.timelines[i].layers[li].frames[fi].duration; } li++; } i++; } } function generateTOC() { // table of contents var str = ""; str += '
'+replaceEntities(script.code)+'\n'+ '