Groups | Blog | Home
all groups > flash actionscript > january 2005 >

flash actionscript : Flash Player History of XML Support?


ThinkSeed
1/14/2005 10:04:51 PM
After running several tutorials and throught the help of these forums, I'm
pulling together a usable first bit of code. I just inserted the code into an
existing file made in Flash MX 2004 that was exporting the SWF as Flash 5. I
noticed the code was not working. After a bit of troubleshooting, I noticed the
code wasn't pulling in the XML file. When I changed the export to Flash Player
6, it worked again. Is Flash 5 support for XML limited? My guess is that the
problem lies mostly in pulling in the XML file with the following code:
offices_xml=new XML(); offices_xml.ignoreWhite=true; offices_xml.onLoad=parse;
offices_xml.load('worldwide_offices.xml');
abeall
1/14/2005 10:16:12 PM
Well, this doesn't help you solve anything, but in the AS dictionary it says:
Use the methods and properties of the XML object to load, parse, send, build,
and manipulate XML document trees. In Flash MX, the XML object has become a
native object. As such, you will experience dramatic improvement in
performance. XML is supported by Flash Player 5 and Flash Player 6. And all
methods in question said they were available for Flash 5. You may want to
change your onLoad to a traditional function, who knows that might eb giving
Flash 5 problems.
ThinkSeed
1/14/2005 10:45:07 PM
I actually did create a traditional function for parse (at least I think I
did). Here's the two functions I created. Maybe there's some code in here
that's unsupported in Flash 5? function parse(success){ if(!success){
trace('problem'); return; } //we will pass the string 'worldwide' into
the listNames function later to specify which map to use in the XML
plotOffices('worldwide'); } function plotOffices(mapname){ //Each attached
movie will need a unique level. 'levelCounter' is the incremented variable to
give it a new level. var levelCounter = 10; var
continents=offices_xml.childNodes[0].childNodes; for(var
s=0;s<continents.length;s++){ var countries=continents[s].childNodes;
for(var t=0;t<countries.length;t++){ var office=countries[t].childNodes;
for(var u=0;u<office.length;u++){ var map=office.childNodes; /*
The following methods first converts the string into lowercase then splits
it into an array with the designated delimiter and then immediately joins
the array back into a string without the delimited character. This was
necessary since an instance name cannot have any spaces in it. */ var
get_office=office.attributes.name.toLowerCase().split(' ').join(''); var
office_nodots=get_office.split('.').join(''); var
office_noslash=office_nodots.split('/').join(''); var
office_nocomma=office_noslash.split(',').join('');
office_name=office_nocomma var
x=map[0].childNodes[0].firstChild.nodeValue; var
y=map[0].childNodes[1].firstChild.nodeValue; //This is what actually
plots the point into the 'world' movieclip. _root.world.attachMovie('Plot',
office_name, levelCounter, {_x:x, _y:y}); //This increments the level
counter. levelCounter += 1; } } } }
ThinkSeed
1/18/2005 7:03:13 PM
Any ideas?

AddThis Social Bookmark Button