PDA

View Full Version : How to add a movieclip into a selected movieclip


Narendrakumar
08-09-2006, 03:43 AM
can anyone provide solution to add a particular movieclip from library into
the selected movieclip.also i need to change the _x,_y,_width,_height,instancename properties of the selected and inserted movieclips.


for example suppose a movieclip named face_mc is selected on stage.
while executing the JSFL it should contain a movieclip (named eye from library).i have to change its properties too.

androo_animator
08-13-2006, 11:00 PM
// with two items in the library, "face" and "eye", select an instance of face on the stage and run this command:
var doc = fl.getDocumentDOM();
if (doc.selection.length == 1) {
var xPosition = 0;
var yPosition = 0;
var libraryName = doc.selection[0].libraryItem.name
doc.library.editItem(libraryName);
doc.library.addItemToDocument({x:xPosition , y:yPosition}, "eye");
doc.exitEditMode();
}

or, without having to select it first


var doc = fl.getDocumentDOM();
var xPosition = 0;
var yPosition = 0;
doc.library.editItem("face");
doc.library.addItemToDocument({x:xPosition , y:yPosition}, "eye");
doc.exitEditMode();