Saturday, March 8, 2008

Unable to resolve '[file]' for transcoding

So I was happy building my project in Flex Builder, till I committed my code and CruiseControl complained that I cannot build it ! See, CC uses compc (the command line compiler) to compile the module and it was returning:

unable to resolve 'assets/cross_cursor.png' for transcoding.

Here is what the code looked liked.

[Embed(source="assets/cross_cursor.png")]

So I said to my self, "Oh come on! I thought you can handle pngs. Poop !" - Googled the error and found this link. And the solution was to add a "/" in front of "assets":

[Embed(source="/assets/cross_cursor.png")]

Now I'm happier :-)

11 comments:

Ned said...

Do you have any idea how to fix this problem for fonts?

I am trying to embed a font as such:

fontFamily: "Century Gothic";
fontWeight: lighter;
fontStyle: normal;
src: url("/assets/gothic.ttf");

I have placed the gothic.ttf TrueType font file in assets and I always get the error. Any ideas?

Thank you.

Dzioker said...

Hi Ned,

If you haven't found this solution already, you just need to add

-managers flash.fonts.AFEFontManager

To the "Additional Compiler Arguments" in the properties of the project.

Jobin Basani said...

Thanks..!
Was wondering what caused the error!

Lanny said...

Thanks for your post. It resolved my issue, but for some reason it was only necessary on some files. Others worked fine without the preceding slash.

Cheers.

Nadia said...

i tried to resolve this problem by adding '/' at the fornt but didnot work. The solution i found is to add two dots and slash. e.g
[Embed("../assets/soundSample.mp3")]

ThunderHead said...

Thanks for sharing

Tyler Arehart said...

I had this problem with @Embed('../img/check.png'), and I changed it to @Embed('/../img/check.png') and it works. Thanks for posting!

Note for the search engines, I came across this when trying to generate ASDoc.

@SeasideVenturaCA said...

This problem is driving me crazy...I've tried all of the above to add a static legend png to a CreatePDF widget in the SFV and nothing works...I still get this error message

[Embed(source="/assets/images/basemap.png")]
[Bindable]
var pngBytes:Class;

myPDF.addImageStream( new pngBytes() as ByteArray, 0, 0, 0, 0, 1, "false");

Thanks,

John said...

That's the answer that I'm finding all over the internet, but I can't seem to get it to work. I must be doing something else wrong. I just started using FlashDevelop for the first time today, and I'm using the FlashPunk engine with it. Here's my code:

package
{
import net.flashpunk.Entity;
import net.flashpunk.graphics.Image;

public class MyEntity extends Entity
{
[Embed(source="/assets/fireball.png")]
private var PLAYER:Class;

public function MyEntity()
{
graphic = new Image(PLAYER);
}

override public function update():void
{
trace("MyEntity updates.");
}
}
}

Any ideas?

ThunderHead said...

hum - not sure - maybe SDK version ? I'm using Flex 4.1

Aneesh said...

I found a workaround for this problem:

It could be a JDK problem.

http://mytechieblog.blogspot.com/2011/06/error-unable-to-transcode-assetsxyzpng.html

Cheers
Aneesh