Flash CS4,JSFL:更改exportPNG的设置
我需要使用JSFL将FLA导出为PNG图像序列 我面临的第一个问题是无法调用document.importPublishProfileString来更改当前发布配置文件,它总是失败并返回0。现在,我创建了一个单独的发布配置文件,如果已经存在,则将其删除。我不知道为什么文档中没有提到它 第二个问题更为严重。调用document.exportPNG时,将忽略发布配置文件。将使用上次在“文件>导出>导出电影”对话框中使用的宽度和高度。配置文件是使用正确的设置创建的,我可以使用UI查看它们。现在,甚至通过UI文件>发布发布也使用电影导出中的设置Flash CS4,JSFL:更改exportPNG的设置,flash,flash-cs4,flash-cs3,jsfl,Flash,Flash Cs4,Flash Cs3,Jsfl,我需要使用JSFL将FLA导出为PNG图像序列 我面临的第一个问题是无法调用document.importPublishProfileString来更改当前发布配置文件,它总是失败并返回0。现在,我创建了一个单独的发布配置文件,如果已经存在,则将其删除。我不知道为什么文档中没有提到它 第二个问题更为严重。调用document.exportPNG时,将忽略发布配置文件。将使用上次在“文件>导出>导出电影”对话框中使用的宽度和高度。配置文件是使用正确的设置创建的,我可以使用UI查看它们。现在,甚至通
fl.outputPanel.clear();
var doc = fl.getDocumentDOM();
var profile = new XML(doc.exportPublishProfileString());
profile.@name = 'Game';
profile.PublishFormatProperties.png = 1;
profile.PublishFormatProperties.flash = 0;
profile.PublishFormatProperties.generator = 0;
profile.PublishFormatProperties.projectorWin = 0;
profile.PublishFormatProperties.projectorMac = 0;
profile.PublishFormatProperties.html = 0;
profile.PublishFormatProperties.gif = 0;
profile.PublishFormatProperties.jpeg = 0;
profile.PublishFormatProperties.qt = 0;
profile.PublishFormatProperties.rnwk = 0;
profile.PublishPNGProperties.@enabled = 'true';
profile.PublishPNGProperties.Width = 500;
profile.PublishPNGProperties.Height = 500;
profile.PublishPNGProperties.Interlace = 0;
profile.PublishPNGProperties.Transparent = 1;
profile.PublishPNGProperties.Smooth = 1;
profile.PublishPNGProperties.DitherSolids = 0;
profile.PublishPNGProperties.RemoveGradients = 0;
profile.PublishPNGProperties.MatchMovieDim = 0;
profile.PublishPNGProperties.DitherOption = 'None';
profile.PublishPNGProperties.FilterOption = 'None';
profile.PublishPNGProperties.MatchMovieDim = 0;
profile.PublishPNGProperties.BitDepth = '24-bit with Alpha';
fl.trace(profile);
if (doc.publishProfiles.indexOf('Game') != -1) {
doc.currentPublishProfile = 'Game';
doc.deletePublishProfile();
}
doc.addNewPublishProfile('Game');
fl.trace(doc.importPublishProfileString(profile));
var exportFileName = doc.pathURI.replace(/%20/g, " ").replace(doc.name, "1/" + doc.name.replace(/\.fla$/, "") + ".png"); // temporary hack
fl.trace(exportFileName);
doc.exportPNG(exportFileName, true, false);
有没有办法从配置文件中设置exportPNG尊重设置?我认为PNG发布设置实际上是指已发布SWF中未经JPG压缩的图像
或者,如果要从SWF面板启动脚本,可以使用发布设置导出SWF,检索它,将其加载到面板中,然后使用类似的方式生成每个帧的PNG。由于您使用的是CS4,Flash Player 10应该允许您保存到本地驱动器。在尝试设置宽度和高度之前,我刚刚更改了您的脚本以先关闭MatchMovieDim,这对我很有效。我认为在MatchMovieDim关闭之前,宽度和高度设置将被拒绝
profile.PublishPNGProperties.MatchMovieDim = 0;
profile.PublishPNGProperties.Width = 500;
profile.PublishPNGProperties.Height = 500;