views:

223

answers:

2

I'm making a SWF panel to automate some file setup. I'm using the libraryPath JSFL command to point to some external libraries. How do I put an item from one of those external libraries onto the stage using JSFL?

I've tried:

fl.getDocumentDOM().library.addItemToDocument({x:0, y:0}, 'myItem');
A: 

Isn't the libraryPath to SWC files as in compiled flex like libraries, not visual components swc files ?

If you want to add component swcs, use the componentPanel object:

fl.componentsPanel.addItemToDocument({x:0, y:200}, "User Interface", "Button"); 

HTH, George

George Profenza
A: 

From Adobe's documentation :

var itemIndex = fl.getDocumentDOM().library.findItemIndex( "myItem" );
var theItem = fl.getDocumentDOM().library.items[itemIndex];
fl.getDocumentDOM().addItem( {x:0,y:0}, theItem );

Cheers,

Nicolas

Nicolas