Skip to main content
Inspiring
January 25, 2007
Question

Custom Map in flash using XML data for dynamic map and point of intrest loading...

  • January 25, 2007
  • 4 replies
  • 727 views
Been some time since I have used Flash for anything...

I'm working on a little project to dynamically build a map and set points of interest on the map. At this time I have the (mySQL) data being queried and formatted with PHP and pushing the data to Flash as XML.

In starting the project I'm a bit lost... I mean I have my data and a good XML format but as it is I'm lost on parsing the data in Flash and assigning its values to movie clips or other...

I've looked at the Loader Component and the XML Connector Component and find I can get that to work at all...

My second though was to create a single movie clip on stage and give it an instance name of "Background" and have it load the URL of an image given in the attached XML doc... Node "a_zone" and the value given to attribute "image"... But this brings me back to square one of not quite understanding Flash and parsing XML... With this second idea I would use AS to create a movie clip, set it's X & Y cords and load an image to it based on the XML attributes listed in the "Gatherable" node (one for each node).

Any suggestions, examples or related info is welcome...

Thanks in advance!
This topic has been closed for replies.

4 replies

Inspiring
July 20, 2007
Pulling this one back out of the Archive...

LuigiL I have tried a few things to attach a movieclip to the dynamic movieclip to show the data related to the dynamic clip...

with no luck it seems...
Inspiring
July 20, 2007
forgot my code
Inspiring
January 25, 2007
Flash 8 Pro, testing in all browsers with current plugins
Inspiring
January 25, 2007
Changed the script somewhat to create clips with unique instance names and on their own depths. And you might want to use the MovieClipLoader Class instead of MovieClip.loadMovie()

Inspiring
January 25, 2007
The MovieClipLoader Class is new to me, I'll have to read up on it. But I noticed the unique instance name change... good plan.

Thanks for the help, I'll marked this answered. If you can relate to me where I might read up on the MovieClipLoader Class, other than the help section please do.
Inspiring
January 25, 2007
To save myself some bandwidth I changed the file to be all made on the fly...

Still no luck getting the Gatherable data to display despite it being traced durring testing...

Please, if you can tell me where I went wrong...
Inspiring
January 25, 2007
You parse the xml in Flash using an instance of the XML Class. Inside the callback handler onLoad you can write your parsing routine. Usually you create an array and push the nodes as objects in the array. To make life easier you can use utility classes from third parties like XMLObject from Sephiroth (www.sephiroth.it) or XPath from xfactorstudio (www.xfactorstudio.com).
For more info on how to parse XML, there are examples in the directory where you have the Flash 8 program and you can check the help-files by hitting F1 in Flash.
Inspiring
January 25, 2007
Okay, that really wasn't what I was looking for... But I did go back and RTM :-)

Here's what I have... 1st frame:

2nd Layer: movieclip with the instance name "currentPicture"

The image loads into "currentPicture" from the URL given in the XML "a_zone" node attribute "image" just fine....

But I'm not able to grab the attributes of each "Gatherable" node it seems... am I missing something or just not pointing to the right node?

I keep getting:

undefined
undefined
undefined
Error opening URL "file:///C|/apache2triad/htdocs/gatherer/flash/undefined"
Error opening URL "file:///C|/apache2triad/htdocs/gatherer/flash/undefined"
Error opening URL "file:///C|/apache2triad/htdocs/gatherer/flash/undefined"

Inspiring
January 25, 2007
Noticed I missed something there and now my traces work... but no image loading that I can see for the Gatherable...