Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mxmlc embedding assets

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?

like image 828
2xMax Avatar asked Jun 08 '11 12:06

2xMax


1 Answers

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.

like image 185
Scott A Avatar answered Sep 19 '22 12:09

Scott A