问题
I need to access MovieClips from an SWC created in Flash using getDefinitionByName() in Flash Builder. I know I have to add in the full package name whilst doing this, like so, with the package name being 'com.fusepump':
var className:String,
assetName:String,
obj:Class,
i:uint;
for (i = 0; i < Config.ASSETS.length; i ++)
{
className = String('com.fusepump.' + Config.ASSETS[i]);
assetName = String(Config.ASSETS[i]).charAt(0).toLowerCase() + String(Config.ASSETS[i]).substr(1, String(Config.ASSETS[i]).length);
obj = getDefinitionByName(className) as Class;
_assets[assetName] = new obj();
}
The problem is that I don't seem to have any control of the package name in the SWC exported from Flash. In the Referenced Libraries directory the MovieClips are under Assets.swc/default package/Asset_1.abc - If I were able to add it to a named package the problem would be solved.
回答1:
I had such problems too. Try this solution Flash Builder - How to build or include an SWC you can build SWC in flashBuilder. The ones from flash ide are wierd to use in FlashBuilder.
来源:https://stackoverflow.com/questions/22647257/movieclip-assets-swc-from-flash-inaccessible-in-flash-builder-using-getdefinitio