Problem embedding assets from 'assets' folder
Hello all,
I"ve run into a problem with intelliJ that I can't seem to resolved myself. In my src folder I have assets/ and src/. In one of my .as files I'm trying to do a simple embed:
[Embed(source='assets/sounds/walk.mp3')] private var WalkSound:Class;
This fails, saying that it can't find the sounds folder which is clearly there with a walk.mp3 in it. Attempting to use the autocomplete will show me the contents of the assets folder, which surprisingly the contents of the assets folder in the Flex sdk.
This example works in Flashbuilder ok. I'm using IntelliJ 10.0.2 and Flex 4.5.0.19786. Any ideas? And I unforunately can't just change the folder name :(
Thanks,
TJ
Please sign in to leave a comment.
Spec requires leading slash, but FB uses own path resolver and doesn't care about Adobe's own spec.
So to make code clean please write [Embed(source='/assets/sounds/walk.mp3')]
I love you.
I'm sorry but I have one more issue. On a different module for the project the assets folder is at the same level as the src folder. So I add it as a src folder and try to embed it using the '/' at the start but no luck. Thoughts?
Thanks again,
TJ
Spec allows paths relative to current file (not starting with slash) or relative to any of source folders (starting with slash). If 'assets' itself is a source folder then you do not need to use it as the beginning of the path and path will look like "/image.png" or "/images/image.gif". Or relative to current file like "../assets/image.png". Absolute paths are also allowed.