Share Posted January 30, 2014 xmlLoader = new LoaderMax({name:"aName", autoDispose :true, onComplete:propsLoaded}); xmlLoader.append(new XMLLoader(curTaleDirectory+ "/" +Constants.PROPS_XML_FILENAME, {name:"anotherName"+_taleId.toString() , autoDispose :true, estimatedBytes:841 })); xmlLoader.load(); private function propsLoaded(e:LoaderEvent):void { var objects:Array = e.currentTarget.content; var taleProps:XML = objects[0]; // This ONLY works on mobile devices..! //TODO: Why doesnt it recognise the WHOLE file? trace(taleProps); // prints this: <?xml version="1.0" encoding="utf-8"?> } <?xml version="1.0" encoding="utf-8"?> <tale id="1"> <page id="1"> <taleText> Lorem ipsum bla bla </taleText> <LoaderMax name="ft$1:page$1"> <MP3Loader name="ft$1:page$1:mc$1$always" url="page_1/backsound.mp3" estimatedBytes:"2050" autoPlay="false" /> <MP3Loader name="ft$1:page$1:mc$1$onClick" url="page_1/backsound.mp3" estimatedBytes:"2050" autoPlay="false" /> </LoaderMax> </page> <page id="2"> </page> <page id="3"> </page> <page id="4"> </page> <page id="5"> </page> <name>aName</name> <purchased>true</purchased> <pageCnt>20</pageCnt> <url></url> </tale> I'm using the code above to load the above xml file.. Instead of getting the whole file loaded, I only get the first line.. Why is that? Thank you.! Link to comment Share on other sites More sharing options...
Share Posted January 31, 2014 Hmmm, I'd make sure that your xml isn't malformed or contains any weird hidden characters. I used similar code to your example and created an xml-file with the data above and was getting errors basically saying that the loaded content could not be converted to xml. Your ActionScript looks fine. I simplified the XML and didn't get any errors. my AS: import com.greensock.loading.*; import com.greensock.events.LoaderEvent; LoaderMax.activate([XMLLoader]); var xmlLoader = new LoaderMax({name:"aName", autoDispose :true, onComplete:propsLoaded}); xmlLoader.append(new XMLLoader("data.xml", {name:"anotherName", autoDispose :true, estimatedBytes:841 })); xmlLoader.load(); function propsLoaded(e:LoaderEvent):void { var objects:Array = e.currentTarget.content; var taleProps:XML = objects[0]; trace(taleProps); // no errors, shows full xml } my XML <?xml version="1.0" encoding="utf-8"?> <data> <asset name="fred"></asset> <asset name="fred"></asset> <asset name="fred"></asset> <asset name="fred"> <img url="fred.jp"></img> </asset> </data> I attached my fla and xml xmlTest_CS5.zip Link to comment Share on other sites More sharing options...
Author Share Posted January 31, 2014 I guess you were right, it was a problem with my xml after all.. Specifically, I had a ":" instead of a "="in this line. estimatedBytes:"2050" That caused the problem. Thank you Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now