-
Notifications
You must be signed in to change notification settings - Fork 0
/
NewAnimClip.jsfl
86 lines (80 loc) · 2.24 KB
/
NewAnimClip.jsfl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
//
// New Animation Clip version 0.9
// copyright © 2006 David Wolfe dave@ironwagon.com
//
var curLayer = fl.getDocumentDOM().getTimeline().currentLayer;
fl.getDocumentDOM().getTimeline().setSelectedLayers(curLayer);
fl.getDocumentDOM().getTimeline().layers[curLayer].layerType = "guide";
fl.getDocumentDOM().getTimeline().copyFrames();
fl.getDocumentDOM().getTimeline().layers[curLayer].layerType = "guide";
var doc = fl.getDocumentDOM();
var lib = doc.library;
//var result = doc.xmlPanel(fl.configURI + "XULControls/newanimclip.xml");
//if(result.dismiss=="accept"){
//if(lib.itemExists(result.symbName)){
//alert("Symbol Name already exists")
//}
//else
{
//
// deselect all, make new layer, make new rectangle with no outline,
//
doc.selectNone;
doc.getTimeline().addNewLayer();
doc.addNewRectangle({left:0, top:0, right:640, bottom:640}, 0, false, true);
//
// returns the current layer and frame
//
function getCurrentFrame()
{
var tl = doc.getTimeline();
var layerNum = tl.currentLayer;
var frameNum = tl.currentFrame;
var curr_frame = tl.layers[layerNum].frames[frameNum];
return curr_frame;
}
//
// gets reference to current frame elements
//
function getCurrentElements()
{
var curr_frame = getCurrentFrame();
return curr_frame.elements;
}
//
// if anything is selected it gets deselected,
// element is added to new selection array
//
function selectElement(elem, bReplace)
{
if(bReplace)
{
doc.selectNone();
}
var selArray = new Array;
selArray[0] = elem;
doc.selection = selArray;
}
//
// select current elements and converts to symbol
// centers the symbol
// edit in place
// deletes the selected elements
//
var elems = getCurrentElements();
for(var i=0; i<elems.length; i++)
{
selectElement(elems[i], true);
doc.convertToSymbol('graphic', '', "center");
lib.setItemProperty('linkageImportForRS', false);
lib.setItemProperty('linkageExportForAS', false);
lib.setItemProperty('linkageExportForRS', false);
lib.setItemProperty('scalingGrid', false);
doc.align('horizontal center', true);
doc.align('vertical center', true);
doc.enterEditMode('inPlace');
//doc.selectAll();
//doc.deleteSelection();
fl.getDocumentDOM().getTimeline().pasteFrames()
}
};