08 October 2010

XML.appendChild FlashPlayer 10 - Known Bug. But wait...there's more!

I just hit a problem with XML.appendChild not accepting String values when you publish a swf for Flash Player 10.1

Doing this:
myXml.appendChild("<node>"+value+"</node>");
Will not work, this will:
myXml.appendChild(<node>{value}</node>);

Which is fair enough as it's strict E4X. What irks me is something that has worked now doesn't, which has caused problems with our custom swc API libraries that I've just spent a few hours fixing.

In the release notes for Flash Player 10.1 there is this entry:
"XML.appendChild does not function correctly when published as SWF10; works fine as SWF9. (2340839)"

"works fine as SWF9" - thanks! Not "fine" when I'm trying to implement 10.1 specific features.

Read those release notes some more and you discover fundamental issues:
  • [FP-1569] AS3 Timeline: Child Sprite ADDED_TO_STAGE event is fired twice. (2300936)
  • AS3 Timeline: First frame of Movie Clip animation played twice when created and added to stage with ActionScript. (2520095)
  • [FP-4423] onEnterFrame gets called more often than necessary. (2614589)
All of which look to be related at some lower level.

So as long as you're not doing any Flash development that requires listening to ADDED_TO_STAGE, or that requires accurate timing when adding MovieClips or using onEnterFrame, you will be fine!

And I certainly won't be using this post to rant about how such critical issues with fundamental features that have worked correctly for years have passed through Adobe QA with little more than a footnote which itself was missing two important words: "Oops, sorry!"