/* LinkageToClip - Aaron Steed / Chris Burt Brown For a project to preload it needs all linkage items to be placed on the stage after the preloader code with all their "export on first frame" checkboxes unticked. In AS3 there is a complication: the whole timeline is executed before the movie runs as normal. This means the linkage items need to be wrapped in a clip and put on the second frame of that clip with a stop action preceding them. This script generates such an item in the library whilst also unchecking all "export in first frame" check boxes. Due to a bug on Macromedia's part, bitmaps marked for export are overlooked - these have to be added to the linkage widget manually. put the jsfl in: C:/Documents and Settings/user/Local Settings/Application Data/Adobe/Flash CS3/en/Configuration/Commands/ */ fl.outputPanel.clear(); var doc = fl.getDocumentDOM(); var lib = doc.library; var lib_items = doc.library.items; var name = prompt("Enter name of clip: "); if(name != null && name.length > 0) { lib.addNewItem("movie clip", name); lib.editItem(name); var timeline = doc.getTimeline(); // insert a stop frame timeline.setLayerProperty("name", "actions"); timeline.layers[0].frames[0].actionScript = "stop();"; // create a handle to grab the object when it is on the timeline timeline.addNewLayer("stuff", "normal", false); doc.addNewRectangle({left:-50, top:-50, right:50, bottom:50}, 0, false, true); doc.selectAll(); doc.setFillColor("#000000"); doc.selectNone(); timeline.insertBlankKeyframe(); // chuck all the library export items onto the second frame for(var n in lib_items) { var this_item = lib_items[n]; if(this_item.linkageExportForAS) { fl.outputPanel.trace(this_item.linkageClassName); this_item.linkageExportInFirstFrame = false; doc.addItem({x:0, y:0}, this_item); } } }