AIR, Flex / Flash, FMS, PushButton, Game… Developer
Flex SDK 4.5 doesn’t keep Embed Metadata
Hey everyone,
I’ve run into a bug with the released version of the Adobe Flex 4.5 SDK. The 4.5 version of the SDK does not respect keeping [Embed] metadata in your SWF. This is problematic because we use this metadata extensively in PushButton Engine.
Take the following example into account:
TestMetadata.as
package { import flash.display.Sprite; import flash.utils.describeType; public class TestMetadata extends Sprite { public function TestMetadata() { var typeInfo:XML = describeType(TestClassWithEmbed); trace(typeInfo); } } }
TestClassWithEmbed.as
package { public class TestClassWithEmbed { [Embed(source="assets/flip.png", mimeType="image/png" )] public var Flip:Class; [SomeMeta(source="assets/flip.png", mimeType="image/png")] public var Test:Class; } }
In version 4.1 of the Adobe Flex SDK, we get the following back from describeType.
<variable name="Test" type="Class"> <metadata name="SomeMeta"> <arg key="source" value="assets/flip.png"/> <arg key="mimeType" value="image/png"/> </metadata> <metadata name="__go_to_definition_help"> <arg key="file" value="/projects/zaalabs/workspace/TestMetadata/src/TestClassWithEmbed.as"/> <arg key="pos" value="243"/> </metadata> </variable> <variable name="Flip" type="Class"> <metadata name="Embed"> <arg key="source" value="assets/flip.png"/> <arg key="mimeType" value="image/png"/> </metadata> <metadata name="__go_to_definition_help"> <arg key="file" value="/projects/zaalabs/workspace/TestMetadata/src/TestClassWithEmbed.as"/> <arg key="pos" value="136"/> </metadata> </variable>
However, in version 4.5 of the Adobe Flex SDK, you can see the Embed metadata is being omitted. Same exact code, same compiler arguments, nothing has changed except the SDK.
<variable name="Test" type="Class"> <metadata name="SomeMeta"> <arg key="source" value="assets/flip.png"/> <arg key="mimeType" value="image/png"/> </metadata> <metadata name="__go_to_definition_help"> <arg key="pos" value="243"/> </metadata> </variable> <variable name="Flip" type="Class"> <metadata name="__go_to_definition_help"> <arg key="pos" value="136"/> </metadata> </variable>
As you can see, the Embed metadata is being stripped out, even though I explicitly set “–keep-as3-metadata+=Embed,SomeMeta” in the compiler. Since I don’t believe that the Adobe Flash Player team would break describeType in a minor release, I’m led to believe that this is a bug that was introduced in the 4.5 version of mxmlc in the Flex SDK.
Rant
:: UPDATE ::
This seems to have been an isolated incident on this specific day, bugs.adobe.com has worked well for me many times since then.
————————————————————————–
So I tried to do the “correct” thing and file this as a bug on bugs.adobe.com. And would happily do so if the site worked. In fact, in the time I’ve been waiting for bug.adobe.com to load and let me login… not only did I write the test case, but I wrote this entire blog post as well.




[UPDATE]
I was finally able to file the bug, I think… it won’t pull it up. SDK-30485.
10 minutes to diagnose the issue…
15 minutes to blog about it…
45 minutes… and counting to file a bug through the proper channels.

| Print article | This entry was posted by Nate Beck on May 18, 2011 at 8:23 am, and is filed under Flex. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |
No trackbacks yet.
Tip of the Day – Updating to Flash Builder 4.0.1
about 1 year ago - 3 comments
I recently posted about Building AIR 2 applications with Flash Builder 4. There is now an update for Flash Builder 4 which downloads and installs the Adobe Flex 4.1 SDK. According to Renaun Erickson’s post, Flex 4.1 includes Flash Player 10.1 and AIR 2.0. Now, if you’re like me and loathe the Adobe Updater… then
Tip of the Day – Building AIR 2 applications with Flash Builder 4
about 1 year ago - 20 comments
:: Update :: This process has gotten much easier, you can now use software update to get AIR 2 as well as Flash Player 10.1 in Flash Builder… check out this post. Adobe AIR 2 and Flash Player 10.1 were released on June 10th, 2010. It’s an exciting time. This weekend I decided to do
Getting Dirty with the Flex SDK – Slides and Recording
about 2 years ago - 5 comments
I’d like to thank everyone who attended my TechWed presentation yesterday. We had around 85 people in attendance! Thanks to Stacy Sison for convincing me that I should present. I will be giving this presentation again tonight at the Seattle Flex User Group, so if you are in Seattle… show up. We’ll have a bit
Explaining my Adobeholism
about 3 years ago - 6 comments
So earlier today someone sent me an email asking me why I claim to be an Adobeholic. I figured it was an interesting question, so here is your answer… and yes, I’ll admit I’m a fan-boy. My Dock Let’s start off with my dock on my laptop: I’m well aware that this isn’t every piece
Tip of the Day – Flex Coding Conventions
about 3 years ago - 1 comment
Today’s tip is a short one… I have begun planning a very exciting Flex-centric event that is going to be held up here in Seattle. More on that later though. Your tip for the day… The Flex SDK team has a guide that explains the coding conventions that they use within the SDK (for the
Tip of the Day – Get notified when someone checks in to the Flex SDK
about 3 years ago - No comments
Something that I have wanted to do for a while is to be notified whenever anyone checks into the Flex SDK. That way I can keep up with all the changes as they happen. I finally figured out how to set it up today. Visit the commits forum. Click the subscribe button. Select Email or
Tip of the Day – Compile your AIR Applications for Flash Player 10
about 3 years ago - 2 comments
I was playing with Cocomo today and hit a wall dealing with the Flash Player 10 version of Cocomo.swc while using Adobe AIR. I created a new AIR application in Flex Builder 3, and pointed it to the Flex SDK 3.2. I then linked in the FP10 version of Cocomo.swc. Everything was going fine until
Tip of the Day – When to use include
about 3 years ago - 2 comments
A little while ago I posed the following question to the flexcoders mailing list, I just wanted to ping everyone and get their opinion on something. Why would anyone ever want to use the include directive? I’ve recently been working on poorly designed project where at the top of every module there is an “include
Tip of the Day – Using Fireworks to skin those Flex Applications
about 3 years ago - 1 comment
Today I was going to post about using flashvars and widget development. However, as I started to document the process, it became too much information for a single tip. So I’m going to do a separate post walking you through my widget development process. Now on to today’s tip! To be honest with you guys,
Tour de Flex… It’s no rubygems, but it’s a start.
about 3 years ago - No comments
Mike Chambers has a blog post asking, “How can adobe make the as3 learning curve easier”? As I talked about in my Why YOU should contribute to Flex post, Adobe wants our input. Here they are again asking the community, “What do you think”? I commented on Mike’s post. I think that a more centralized
about 9 months ago
What if you try embedding it as a static const, instead of a var? Seems to me that embedded data should never be an instance property in the first place. Then again, I’m not familiar at all with the pushbutton engine.
about 9 months ago
Still has the exact same issue.
about 9 months ago
I filed this as a bug with PushbuttonEngine in the forums and on Google Code a few days ago. I also had the same problem while trying to file a bug with Adobe once I figured out that something had changed on the framework side of things.
http://pushbuttonengine.com/forum/viewtopic.php?f=9&t=1969
http://code.google.com/p/pushbuttonengine/issues/detail?id=185
I’ve got kind of a hunch that it’s actually as deep as the methods in the latest version of Flash Player, or at least as they are described in playerglobal.swc.
Either way, it will be interesting to see what comes of this.
about 9 months ago
If this is NAB (not a bug) I’d love to hear the rationale…
about 8 months ago
If you erally need to access the tEXT meta data inside a PNG and this bug never gets fixed, one workaround is to embed it as a bytearray (mimetype in the ebed tag) and parse it out manually:
http://wonderfl.net/c/oVSK
I’ve not tested this but it looks good:
public static function getMetaData(png:ByteArray):Object{ var metaData:Object = {}; var i:int, j:int, key:String, value:String; for(i = 0; i < png.length - 4; i++){ png.position = i; // look for the tEXt chunk type if(png.readUnsignedInt() == tEXt_ID){ // chunks are broken into length, type, data and CRC // we've stopped at the type, wind back to get the length png.position = i - 4; var totalLength:int = png.readUnsignedInt(); // the key/value is broken with a single 0x0 byte var keyLength:int = 0; for(j = 0; j < totalLength; j++){ png.position = i + 4 + j; if(png.readByte() == 0x0){ keyLength = j; break; } } // capture the key png.position = i + 4; key = png.readMultiByte(keyLength, CHAR_SET); // capture the value png.position = i + 4 + keyLength + 1; value = png.readMultiByte(totalLength - (keyLength + 1), CHAR_SET); metaData[key] = value; } // quit searching once the IDAT chunk is encountered // pngs encoded by this class store the metadata before the IDAT if(png.readUnsignedInt() == IDAT_ID){ break; } } return metaData; }about 7 months ago
Same problem when using FlexORM and Flex 4.5/4.5.1. Been debugging for a day so find out why Lazy Loading doesn’t work.
Any updates on the matter?
about 7 months ago
As of right now, according to the ticket filed at bugs.adobe.com (http://bugs.adobe.com/jira/browse/SDK-30485), this issue is currently under investigation with a potential fix.
Cheers,
Nate