mxmlc 嵌入资产

发布于 2024-11-14 04:59:31 字数 492 浏览 7 评论 0原文

我正在尝试通过这种方式通过 mxmlc 编译我的项目:

[prj_folder]\src>mxmlc mymxml.mxml -library-path+=../libs -sp+=..\assets

并且出现这样的错误:

[prj_folder]\src\view\controls\controlname.mxml(7): Error: Problem finding external st
ylesheet: assets/cssname.css
        <fx:Style source="assets/cssname.css"/>

[prj_folder]\src\view\constants\Images.as(24): col: 3: 错误:无法转码 资产/图标/icon1.png。

如何包含编译器的资产?

I'm trying complie my project via mxmlc this way:

[prj_folder]\src>mxmlc mymxml.mxml -library-path+=../libs -sp+=..\assets

and i get such errors:

[prj_folder]\src\view\controls\controlname.mxml(7): Error: Problem finding external st
ylesheet: assets/cssname.css
        <fx:Style source="assets/cssname.css"/>

[prj_folder]\src\view\constants\Images.as(24):
col: 3: Error: Unable to transcode
assets/ icons/icon1.png.

how to include assets for the compiler?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

怀里藏娇 2024-11-21 04:59:32

这是目录设置问题;不是编译器错误。而且您实际上并没有嵌入资产;而是嵌入了资产。只是参考它们。

使用 Flash Builder 时,文件“assets/cssname.css”应相对于主应用程序文件。我相信如果您使用命令行编译器,也会发生同样的情况。

您的源目录是否有 asset 子目录? cssname.css 文件在里面吗?

This is a directory setup issue; not a compiler error. And you aren't actually embedding assets; just referencing them.

When using Flash Builder, the file "assets/cssname.css" should be relative to the main application file. I believe the same should occur if you're using the command line compiler.

Does your source directory have an assets subdirectory? Is the cssname.css file inside it?

屌丝范 2024-11-21 04:59:31

Flash Builder 对文件进行预处理。

对于这样的目录结构:

projectdir/src/Main.mxml
projectdir/src/views/SomeView.mxml
projectdir/src/assets/MyImage.png

如果 SomeView.mxml 引用 asset/MyImage.png,Flash Builder 将允许这样做:

@Embed('assets/MyImage.png')

因为它被 IDE 预处理为 /assets/MyImage.png,但 ant/maven + mxmlc 不会这样做那。

@Embed('/assets/MyImage.png')

适用于 Flash Builder 和 mxmlc。

如果您使用的是这样的相对路径:

@Embed('../assets/MyImage.png')

尝试将其更改为这样,虽然看起来很奇怪:

@Embed('/../assets/MyImage.png')

前导 / 被转换为“我的 src 目录”,并且 mxmlc 从那里开始计算剩余的路径。

希望这有帮助。

Flash Builder preprocesses the files.

For a directory structure like this:

projectdir/src/Main.mxml
projectdir/src/views/SomeView.mxml
projectdir/src/assets/MyImage.png

And if SomeView.mxml references assets/MyImage.png, Flash Builder will allow this:

@Embed('assets/MyImage.png')

because it is preprocessed to /assets/MyImage.png by the IDE, but ant/maven + mxmlc won't do that.

@Embed('/assets/MyImage.png')

works for both Flash Builder and mxmlc.

If you are using a relative path like this:

@Embed('../assets/MyImage.png')

try changing it to this, odd as it may seem:

@Embed('/../assets/MyImage.png')

The leading / gets translated to "my src directory", and mxmlc does the remainder of the path calculation from there.

Hope this helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文