PDA

View Full Version : Enter editMode after convertToSymbol?


svdelle
09-18-2008, 08:38 AM
This is JSFL in case you were wondering ...

I'm adding tons of 'Groups' to the library using:

var allElements = fl.getDocumentDOM().getTimeline().layers[0].frames[0].elements;
var selectionArray = new Array;
for(var i=0;i < allElements.length;i++){
fl.getDocumentDOM().selectNone();
selectionArray[0] = allElements[i];
fl.getDocumentDOM().selection = selectionArray;
if(allElements[i].elementType != "instance") // Leave MCs alone
{
// Add symbol to library (with default name 'instance1' etc.)
fl.getDocumentDOM().convertToSymbol("movie clip", "", "top left");

/*
How do I:
1. Enter editMode on newly created symbol?
2. Add new layer in symbol (as the bottom layer, as I'm trying to expand the clickable area below a letter shape)
3. Draw rect, something like this ...
newly_added_mc.addNewRectangle({left:0, top:0, right:st.width, bottom:st.height}, 0);
newly_added_mc.selectAll();
newly_added_mc.breakApart();
newly_added_mc.setFillColor("#000000");
newly_added_mc.setStroke("#00000000", 1, "solid");
newly_added_mcselectNone();
newly_added_mc.exitEditMode();
*/
}
}

aravinth_vt
09-25-2008, 10:30 AM
Hi,

try this one

function main(){
var allElements = fl.getDocumentDOM().getTimeline().layers[0].frames[0].elements;
var selectionArray = new Array;
for(var i=0;i < allElements.length;i++){
fl.getDocumentDOM().selectNone();
selectionArray[0] = allElements[i];
fl.getDocumentDOM().selection = selectionArray;
if(allElements[i].elementType != "instance") // Leave MCs alone
{
// Add symbol to library (with default name 'instance1' etc.)
var elem=allElements[i];
fl.getDocumentDOM().convertToSymbol("movie clip", "", "top left");
fl.getDocumentDOM().enterEditMode("inPlace");
fl.getDocumentDOM().getTimeline().addNewLayer("rect","normal",false);
fl.getDocumentDOM().addNewRectangle({left:0, top:0, right:elem.width, bottom:elem.height}, 0);
fl.getDocumentDOM().exitEditMode();
}
}
}
main()