// This code will need you to have a button in the library called “bar capped grey”
// selects the item in library called “bar capped grey” and starts editing it
fl.getDocumentDOM().library.editItem(“bar capped grey”);
//add a new layer
fl.getDocumentDOM().getTimeline().addNewLayer();
//add text box anywhere in the timeline of the button
fl.getDocumentDOM().addNewText({left:-29, top:-10.1, right:-18.8, bottom:6.1});
// text object is autosizing
fl.getDocumentDOM().setElementProperty(‘autoExpand’, true);
//write a value into the text object
fl.getDocumentDOM().setTextString(‘Krishna’);
// use such a command to manually position it
//fl.getDocumentDOM().moveSelectionBy({x:23.9, y:3.9});
//center align it
fl.getDocumentDOM().align(‘vertical center’, true);
fl.getDocumentDOM().distribute(‘horizontal center’, true);
// deselect everything
fl.getDocumentDOM().selectNone();
// lock the layers
fl.getDocumentDOM().getTimeline().setLayerProperty(‘locked’, true, ‘all’);
// done
return to main timeline (Stage)
fl.getDocumentDOM().exitEditMode();
//-------------------------------------------
always open the history panel, then simulate what you want to do manually
then go to the history panel copy the commands and paste it into the script editor.
then fine tune it to your needs… this saves time, as flash automatically
writes jsfl code for you in the history panel.