There seems to be a change to the way the E4X xml parsing in Flash 10 and or (flash professional cs4). I can't say if its a bug, but rather a change in the way they do the parsing. I did some searching on google and found similar posts some non related to flash10/cs4... like this guy's example about variable names and node names colliding in cs4 but not cs3...issue.
http://www.soundstep.com/blog/2008/11/12/flash-cs4-bug-with-xml-e4x-filters/ Anyway here's the issue relating to away3d. Using an example dae file from the latest checkout... square.dae running the project in cs3 works fine.... but in cs4 it produces these TypeError: Error #1009: Cannot access a property or method of a null object reference. errors. After some debugging it comes down to the collada loader ... >From the latest SVN checkout of away3d.loaders.Collada.as If you goto line 793 where it says geo = collada.library_geometries.geometry.(@id == getId([EMAIL PROTECTED])) [0]; This is where the error occurs... geo is null... Now here's the issue, the issue is the word 'child' is being reserved. You can prove this by changing line 793 to.... var foo = child; geo = collada.library_geometries.geometry.(@id == getId([EMAIL PROTECTED]))[0]; further confirmed by doing these 2 tests: geo = collada.library_geometries.geometry.(@id == Debug.trace("test: '" + [EMAIL PROTECTED] + "'"))[0]; // output is test: '' vs var foo = child; geo = collada.library_geometries.geometry.(@id == Debug.trace("test: '" + [EMAIL PROTECTED] + "'"))[0]; // output is test: '#Cylinder-Geometry' It runs fine in that case...on cs3 and cs4... but this fix only fixes this one instance, you can see another example of something to break on line 782: parseNode(collada.library_nodes.node.(@id == getId([EMAIL PROTECTED]))[0], _objectData as ContainerData); The only proper way is to not use the keyword child as a variable (or using any nodename's as variables as illustrated by the url reference at the top), which I have done so in my Collada.as (svn diff below). I suspect there will be more issues of this nature regarding flash 10/ cs4 in other files/loaders/anything doing e4x syntax on xml files. It just so happens I spent a great amount of time debugging my dae files because I was getting these errors, and it turns out out this was the problem. So I'm finally past the dae loading hump, now trying to get my animation working! I didn't know the proper procedure to submit a patch_diff so excuse me if this is the wrong place... So its just pasted below ---------------snip patch-------------- Index: Collada.as =================================================================== --- Collada.as (revision 838) +++ Collada.as (working copy) @@ -1,4 +1,4 @@ -package away3d.loaders +package away3d.loaders { import away3d.animators.*; import away3d.animators.skin.*; @@ -732,10 +732,10 @@ var arrayChild:Array var boneData:BoneData = (_objectData as BoneData); - for each (var child:XML in node.children()) + for each (var nodeChild:XML in node.children()) { - arrayChild = getArray(child); - switch (child.name().localName) + arrayChild = getArray(nodeChild); + switch (nodeChild.name().localName) { case "translate": _transform.multiply(_transform, translateMatrix(arrayChild)); @@ -743,7 +743,7 @@ break; case "rotate": - sid = [EMAIL PROTECTED]; + sid = [EMAIL PROTECTED]; if (_objectData is BoneData && (sid == "rotateX" || sid == "rotateY" || sid == "rotateZ" || sid == "rotX" || sid == "rotY" || sid == "rotZ")) boneData.jointTransform.multiply(boneData.jointTransform, rotateMatrix(arrayChild)); else @@ -771,26 +771,26 @@ //<node><node/></node> if(_objectData is MeshData) { - parseNode(child, parent as ContainerData); + parseNode(nodeChild, parent as ContainerData); }else{ - parseNode(child, _objectData as ContainerData); + parseNode(nodeChild, _objectData as ContainerData); } break; case "instance_node": - parseNode(collada.library_nodes.node.(@id == getId ([EMAIL PROTECTED]))[0], _objectData as ContainerData); + parseNode(collada.library_nodes.node.(@id == getId ([EMAIL PROTECTED]))[0], _objectData as ContainerData); break; case "instance_geometry": - if(String(child).indexOf("lines") == -1) { + if(String(nodeChild).indexOf("lines") == -1) { //add materials to materialLibrary - for each (instance_material in child..instance_material) + for each (instance_material in nodeChild..instance_material) parseMaterial([EMAIL PROTECTED], getId([EMAIL PROTECTED])); - geo = collada.library_geometries.geometry.(@id == getId ([EMAIL PROTECTED]))[0]; + geo = collada.library_geometries.geometry.(@id == getId ([EMAIL PROTECTED]))[0]; (_objectData as MeshData).geometry = geometryLibrary.addGeometry([EMAIL PROTECTED], geo); } @@ -800,15 +800,15 @@ case "instance_controller": //add materials to materialLibrary - for each (instance_material in child..instance_material) + for each (instance_material in nodeChild..instance_material) parseMaterial([EMAIL PROTECTED], getId ([EMAIL PROTECTED])); - ctrlr = collada.library_controllers.controller.(@id == getId ([EMAIL PROTECTED]))[0]; + ctrlr = collada.library_controllers.controller.(@id == getId ([EMAIL PROTECTED]))[0]; geo = collada.library_geometries.geometry.(@id == getId ([EMAIL PROTECTED]))[0]; (_objectData as MeshData).geometry = geometryLibrary.addGeometry([EMAIL PROTECTED], geo, ctrlr); - (_objectData as MeshData).skeleton = getId(child.skeleton); + (_objectData as MeshData).skeleton = getId(nodeChild.skeleton); break; } } ------------ end snip patch --------------
