Decoding Flex “Unable to transcode” SWF error
Tonight (this morning?) while catching up on some work, I was trying to embed assets created in Flash in a Flex project, using the good ‘ole Embed method. I’ve done dozens of times with excellent results, but this time was different. For some reason, my tried and true approach was generating an ambiguous error message from the Flex compiler.
It read as follows:
Unable to transcode Assets.swf
I wasted a bunch of my own time (and some of Abdul Qabiz’s) trying to figure it out, but nothing I tried seemed to work. Of course I googled for help, and the results their were even more mystifying. The only post I could find that sounded remotely close to what I was experiencing was this: http://www.codeverge.net/item.aspx?item=100658 and even though “mac_55″ was able to get it working, he had – as he put it, “No idea why it wasn’t working before.” That didn’t help much.
I started to suspect that Flash was somehow to blame, so I tried using another existing asset SWF that I had used w/ success in a previous project. Low and behold, it worked perfectly. Okay, that’s a clue… it’s somewhere in Flash.
Next, I saved the .fla that created the SWF that was working to the desktop and recompiled… then I tried using the resultant SWF in Flex again. You guessed it, it didn’t work.
Now I was really starting to think I was on to something, Flash was creating corrupt SWFs for some reason. I had crashed Flash about 10 times earlier trying to import PSDs, so I thought a restart may be in order, hopefully to resolve some phantom memory leak. So, I restarted.
After restart, I opened the previously successful, but now failing .fla and rebuilt. I noticed a ton of errors. Apparently, when I saved the .fla to the desktop, I broke the dependency chain somewhere and caused a bunch of errors. I realized that I hadn’t seen the errors before, most likely because the Output window was buried beneath a bunch of panels. Then, I opened the .fla for my apparently un-transcodable SWF – published the movie and poop, an error. Apparently “Background” is a reserved name, and my library item w/ the linkage id “Background” was causing the error. I changed the name to “BG”, it compliled fine, and worked perfectly in Flex.
The morale of the story is: if you see the “Unable to transcode” error message, make sure you’re freakin’ SWF is building properly. duh.
Hopefully someone on the Flex team can make sure that we get a more verbose error message in Flex 4.
November 24, 2008 - 12:21 am
I have also same problem. I wonder if the problem is about swf file generated? Is there a trich to create swf file from fla?
If anyone know the answer or try to test in their environment, I can link the file also.
Thank you.
Asiye
November 24, 2008 - 8:01 am
The problem is that there was an error in the SWF. Double check your SWF to ensure that there are absolutely no compiler errors.
January 5, 2009 - 3:01 pm
I’m an experienced Flex developer, but a Flash CS4 newbie. I thought the error “unable to transcode xxx.swf†was caused by a Flex 3/ Flash CS4 compatibility issue. I spent an entire day trying to resolve this problem. It turns out if you don’t set up the linkage on individual movie clips as “Export for ActionScript,†Flex can’t find the symbol definitions. However, and this is what messed me up, instead of just reporting that it can’t find the symbol definitions, it also reports that it can’t transcode the SWF, which led me to believe there was something wrong with the SWF. Now I know better.
January 20, 2009 - 1:14 pm
I had this problem.
I’m a starter in Flex and may be you try that I will write, but it helped me.
In symbol properties i check:
“Export for action script”
“Export in frame 1″
and
enter the CLASS_NAME
After that I go to Component Definition and set the Class name as CLASS_NAME.
After this I have embended swf file and get access to my movie clip.
May 10, 2009 - 10:55 am
Thx, this article saved me a lot of time! I had the exact same problem, somehow using Background as a linking/class name creates a conflict. However the error isn’t descriptive enough to find the problem but google is
August 15, 2009 - 3:26 pm
hello
must be the absolute link in the source
September 17, 2009 - 4:57 pm
i had this problem too. and this worked for me.
right click the symbol in the library -> properities -> tick export for AS.
and enter the class name.
October 23, 2009 - 1:28 pm
I ran into this problem and after some double checking this:
[Embed(source="PuzzleAssets.swf", symbol="Wheel2")]
changed into this:
[Embed(source="../assets/games/PuzzleAssets.swf", symbol="Wheel_2.ai")]
once I got the path right and the symbol matching the export name, then it worked. Thanks, hope this helps too!