Mxmlc asset injection

I am trying to execute my project through mxmlc as follows:

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

and I get errors like this:

 [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: Cannot recode assets / icons / icon1.png.

How to enable assets for the compiler?

+6
source share
2 answers

Flash Builder prepares files.

For such a directory structure:

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

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

 @Embed('assets/MyImage.png') 

because it is pre-processed by /assets/MyImage.png using the IDE, but ant / maven + mxmlc will not do this.

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

works for both Flash Builder and mxmlc.

If you use the relative path as follows:

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

try changing it to this, oddly enough:

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

The host / translates to "my src directory", and mxmlc does the rest of the calculation of the path from there.

Hope this helps.

+6
source

This is a directory installation problem; not a compiler error. And you are not really introducing assets; just referring to them.

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

Does your source directory have a resource subdirectory? Does it contain the cssname.css file?

0
source

Source: https://habr.com/ru/post/890048/


All Articles