Sunday, April 5, 2009

Unable to resolve for transcoding with embed image

Ok, at home I was making a new as3 project with flashdevelop.
Everything was working great, untill I wanted to use the [embed] code.

At work there's no problem with it, but here at home it just didn't work. And I was sure that I dit the same thing... here is what I did,

[Embed(source="../images/425400.png")]
protected var myImage:Class;


The compiler gave me this error: Error: Unable to transcode ../images/425400.png.
So, I thought to put the image in the /bin directory. not working either.


[Embed(source="425400.png")]
protected var myImage:Class;


after some searching on the internet, days of waiting and thinking... the solution was way to simple:


[Embed(source="/../images/425400.png")]
protected var myImage:Class;


put a '/' before you're path and it works..

31 comments:

Ofir said...

Thanks a lot. You saved me a lot of time!

Freddy Rios said...

Same for me!

Leavingbehind said...

Me also!
this is the only way of getting paths to work in both Flex & Flashdevelop.

Flex automatically resolves the path, Flashdevelop doesn't - it looks for the embeded files relative from the source file location.

Paladin said...

Thanks a lot.

Craig said...

Worked like a charm!

Chris said...

these kind of thing are very annoying to debug, thanks for the info!

tricycle said...

thanks a LOT!

whereswaldon said...

Thanks!

Denis said...

i really thanks for you

Martin said...

Thanks a lot, I had no idea how to handle this!

Anonymous said...

thanks a million times!

Anonymous said...

Thanks!!! :D

Anonymous said...

thanks a lot.. :D

Anonymous said...

Thanks dude.. you saved me!

Anonymous said...

A couple of years later, and you're still helping people :D You saved me some frustration, thanks a lot!

Anonymous said...

this ismy code, but i still get error

Anonymous said...

You just saved me few hours of searching, thanks!!!

Anonymous said...

thanks a lot, it's very helpfull!!!

Flo said...

Works great, thank you very much!

flabbygums said...

Strange; when I add the "/" in Flash Builder and then go to Flash CS5.5 to export a swc that was complaining about the transcoding error, I get a new error complaining that the feature I'm trying to use requires updating the Flex SDK. WTF?? But other images have worked. The only difference in this PNG was I exported it from Flash. Ideas?

carq said...

thanks man ! searching for this :)

Joe said...

+1

Like

etc :)

Anonymous said...

Much much thanks

d(*u*)b

JK said...

Hi,

I am using flashdevelop 4 to compile some samples from away3D, Advanced_ShallowWaterDemo.as in particular. Since the SimpleGUI package by Justin Windle (uk.co.soulwire.gui) is part of it's dependencies/imports, which in his case is using yours (com.bit101.components)

However I get the following errors and I can't seem to get around the embedding error:


Bit101\com\bit101\components\Component.as(54): col: 3: Error: unable to resolve '../../../../assets/pf_ronda_seven.swf' for transcoding
[Embed(source="../../../../assets/pf_ronda_seven.swf", symbol="PF Ronda Seven")]

Bit101\com\bit101\components\Component.as(54): col: 3: Error: Unable to transcode ../../../../assets/pf_ronda_seven.swf.
^


Any idea's how to get around this?

JK said...

I found it. Path is different in flash develop as it is in flex. Should be:
[Embed(source="../../../assets/pf_ronda_seven.swf", symbol="PF Ronda Seven")]

brent said...

2013 and I'm here with the same problem. You helped me out, thanks for that.

Anonymous said...

thanks man, really appreciate you posting this!

Anonymous said...

fantastic. it saved my time.

Mark Smith said...

[Embed(source="/../lib/meiryo",
fontName = "myFont",
mimeType = "application/x-font",
advancedAntiAliasing="true",
embedAsCFF = "false")]
internal var japanese:Class;

Anonymous said...

thanks, saved me a lot of time

Vusi Mashaba said...

Brilliant thank u.