the XML then supposed to be parsed into an array or each destination is an array with 2 properties x and y . Then draw destination on the map .
My questions is :
How to make a multidimention array like this in flash and access it by name ? sorry , I don’t know much about multidimention array , is it could be like this : **destination.paris.x , destination.paris.y ** . I need these because later I will load another XML doc that include route arrays : route1[paris,london] , route2[london,berlin,paris] .
The other way is make each destination an array : paris[200,150] , london[260,180] … Do you think this way could slow down the movie (wasting RAM ) , yet it could be easier .
Thank you for reading , I hope someone would help me to contruct this array .
question though… if you’ve already got the stats in an xml object… why transplant them to an array? You can read all the data from the xml object already.
thank you so much , both of you with your help , I finally find the way out . I choose jsk’s method .
*Originally posted by david *
**question though… if you’ve already got the stats in an xml object… why transplant them to an array? You can read all the data from the xml object already. **
Please correct me if I’m wrong or my method is not a good method :
I choose jsk’s because I have another XML doc like this
… it will be parsed to single record and showed in one box . the destinations text will be split to an array and then reference to the destination locations XML to draw on the map . The destination locations XML will be loaded at the main movie as Global reference for many records to use . If I don’t contruct this Global array , I’ll have to parse and search for location of each destination whenever load each route .
And because in the record
<destinations>paris,london,berlin</destination>
is just a text so I need the destination location array can be referenced by name .
Thank you again , and please suggest me more if it can be improved .
Flash parses through “attributes” of xml nodes VERY quickly. So fast that you would probebly not notice the difference between it and the array method you chose.
From that set up it’s really just a matter of looking for the node with the right name, and then finding out what it’s xLoc and yLoc are. I’ve been working on a solitare game for weeks now and it’s really hard. I have offset attributes, location attributes, depth attributes…and that’s just for location of the card… let alone things like the suit, color, and value of the card.
Finally I’ve finished the parse code procedure , now I’m trying to solve the problem with route drawing , it’s still a mess though and I hope i’ll not bother you next time , hope so