Using JSFL, pulling items out of a library using libraryPath
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开发者_运维知识库');
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");
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 );
精彩评论