首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >exportPNG CS4 :更改Flash的设置

exportPNG CS4 :更改Flash的设置
EN

Stack Overflow用户
提问于 2010-10-31 05:21:49
回答 2查看 2.7K关注 0票数 0

我需要使用JSFL将FLA导出为PNG图像序列。

我遇到的第一个问题是,我不能调用document.importPublishProfileString来更改当前的发布配置文件,它总是失败(返回0)。现在,我创建了一个单独的发布配置文件,如果已经存在,则将其删除。我不知道为什么文档中没有提到它。

第二个问题更为严重。当我调用document.exportPNG()时,发布配置文件被忽略。我上次在“文件>导出>导出电影”对话框中使用的宽度和高度被使用了。配置文件是使用正确的设置创建的,我可以使用UI查看它们。现在,即使通过UI (文件>发布)发布也使用影片导出中的设置。

代码语言:javascript
复制
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尊重设置?

EN

回答 2

Stack Overflow用户

发布于 2011-02-26 11:46:44

我认为PNG发布设置实际上指的是发布的SWF中非JPG压缩的图像。

或者,如果从SWF面板启动脚本,则可以使用发布设置导出SWF,检索它,将其加载到面板中,然后使用类似AS3CoreLib的内容生成每个帧的PNG。既然你是在CS4中,Flash player10应该可以让你保存到本地驱动器。

票数 0
EN

Stack Overflow用户

发布于 2012-03-19 14:28:14

我刚刚修改了你的脚本,在尝试设置宽度和高度之前,首先关闭了MatchMovieDim,它对我很有效。我认为宽度和高度设置会被拒绝,直到MatchMovieDim关闭。

代码语言:javascript
复制
profile.PublishPNGProperties.MatchMovieDim = 0;
profile.PublishPNGProperties.Width = 500;
profile.PublishPNGProperties.Height = 500;
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/4060734

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档