【发布时间】:2015-06-01 13:36:50
【问题描述】:
几个月前,我使用 FlashDevelop 开发了一个 220x20 的 Flash 电影,左侧有一个 20x20 图像,图像旁边有一个标签,今天我想将该项目移植到一个 maven 项目中。
到目前为止一切顺利,我得到了我的 swf 文件,但 Flash 电影中的内容相对于 Flash 电影的大小进行了调整,因此图像和标签的大小调整为 Flash 电影上边缘的 1 像素线.. .
我的 pom.xml
<properties >
<flex.sdk.version>4.5.1.21328</flex.sdk.version>
<flexmojos.version>4.0-RC2</flexmojos.version>
</properties >
<build>
<finalName>clipboard-action</finalName>
<sourceDirectory>src/main/as3</sourceDirectory>
<plugins>
<plugin>
<groupId>org.sonatype.flexmojos</groupId>
<artifactId>flexmojos-maven-plugin</artifactId>
<version>${flexmojos.version}</version>
<extensions>true</extensions>
<configuration>
<sourceFile>com.someco/Main.as</sourceFile>ß
</configuration>
<dependencies>
<dependency>
<groupId>com.adobe.flex</groupId>
<artifactId>compiler</artifactId>
<version>${flex.sdk.version}</version>
<type>pom</type>
</dependency>
</dependencies>
<executions>
<execution>
<id>html-wrapper</id>
<goals>
<goal>wrapper</goal>
</goals>
<configuration>
<parameters>
<swf>${project.build.finalName}</swf>
<width>220</width>
<height>22</height>
<bgcolor>#FFFFFF</bgcolor>
</parameters>
<htmlName>index</htmlName>
</configuration>
</execution>
<execution>
<goals>
<goal>compile-swf</goal>
</goals>
<configuration>
<compiler>
<optimize>true</optimize>
</compiler>
<default-size>
<width>220</width>
<height>22</height>
</default-size>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.adobe.flex.framework</groupId>
<artifactId>flex-framework</artifactId>
<version>${flex.sdk.version}</version>
<type>pom</type>
</dependency>
</dependencies>
如果我仅在浏览器中查看 swf 文件,则影片的高度为 100%,宽度为 100%。如果我在 html 页面中查看 swf 并将 html 标记设置为宽度 220 和高度 20,则 Flash 电影的大小会正确调整,但电影的内容会调整为 1 像素?所以我认为调整大小的机制是相对的?
那么我在哪里可以设置宽度和高度或绝对/相对调整大小?
注意事项:该项目只包含 Main.as 文件,没有 mxml 文件(我不知道这些 mxml 文件是做什么的......)
【问题讨论】:
-
尝试对生成的 SWF 运行 mediainfo 或类似的信息软件,以确定它是否报告正确的大小 (220x22),也尝试在 Flash 调试器播放器中打开 SWF(如果不这样做,请下载一个拥有它),它还可以以适当的大小显示 SWF。如果这两个都成功显示 220x22 和 220x22 窗口,那么您必须重新检查 HTML 以便在其中找到缩放参数。
-
使用 Flash 调试 (flashplayer_17_sa_debug.exe) swf 也会根据 Windows 大小动态调整大小,MediaInfo 说宽度为 500,高度为 375。但从 500px 到 220px 与标签大小调整无关20px 到 1px?
-
您已经说过标签在顶部边缘被调整为 1 像素 - 这是通过将 20 像素高的对象从已编译 SWF 的 375 像素高度调整为该 SWF 的 20 像素视口而得到的结果。抱歉,无法帮助编译器配置,但请检查您的项目在 Flex 中是否为 220x22,500x375 是否为 IIRC 是 SWF 项目的默认大小。
-
@Vesper 好的,谢谢您提供的信息,我不知道。但是我在哪里可以找到 flex 插件的文档呢?我几乎没有在互联网上找到一些关于如何使用 flex 框架的 sn-ps,但在编译器插件中没有更深入的内容......任何来源?
标签: actionscript-3 maven flash