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)
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!"
1 comment:
Annoying, but a useful reminder that sometimes that bug you are searching for isn't in your code.
I found the bit of code that this was causing problems for me looked a bit like this:
something.something.something.something.myXml.appendChild(myNode)
Wasn't throwing any errors, similar code was working fine in the same file and in many other files i'd made but for whatever reason, in this place, despite being able to see the variable (and edit it in other lines) appendChild simply did not work.
after reading this post I realised that since it was consitantly working in some places but consistantly failing in this place appendChild must work in most contexts, but not all. To fix it I did this.
var tempNode=
something.something.something.something.myXml.copy()
tempNode.appendChild(myNode)
something.something.something.something.myXml=tempNode.copy()
Maybe not the cleanest solution, but a solution none the less.
Post a Comment