mxmlc 嵌入资产
我正在尝试通过这种方式通过 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是目录设置问题;不是编译器错误。而且您实际上并没有嵌入资产;而是嵌入了资产。只是参考它们。
使用 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?
Flash Builder 对文件进行预处理。
对于这样的目录结构:
如果 SomeView.mxml 引用 asset/MyImage.png,Flash Builder 将允许这样做:
因为它被 IDE 预处理为 /assets/MyImage.png,但 ant/maven + mxmlc 不会这样做那。
适用于 Flash Builder 和 mxmlc。
如果您使用的是这样的相对路径:
尝试将其更改为这样,虽然看起来很奇怪:
前导 / 被转换为“我的 src 目录”,并且 mxmlc 从那里开始计算剩余的路径。
希望这有帮助。
Flash Builder preprocesses the files.
For a directory structure like this:
And if SomeView.mxml references assets/MyImage.png, Flash Builder will allow this:
because it is preprocessed to /assets/MyImage.png by the IDE, but ant/maven + mxmlc won't do that.
works for both Flash Builder and mxmlc.
If you are using a relative path like this:
try changing it to this, odd as it may seem:
The leading / gets translated to "my src directory", and mxmlc does the remainder of the path calculation from there.
Hope this helps.