Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Flash Feeding from an XML File

Status
Not open for further replies.

WilliamMute007

Programmer
Sep 30, 2007
116
GB
Hi all,

Please help as I am quite a novice in flash but I need to perform a task with it :( Basically I have a set of images list in an xml file that are pulled to created an swf file as a top banner in the website. Problem: I have that lot working. The only thing now is that, for every section of the website, I want the swf file to use different sets of images defined in the one xml file. i.e

Code:
<?xml version="1.0" encoding="utf-8"?>
<Homepage>
	<image title="" url="Australia_2 2007.jpg" />
	<image title="" url="1.jpg" />
	<image title="" url="2.jpg" />
</homepage>

<AboutUs>
	<image title="" url="Australia_2 2007.jpg" />
	<image title="" url="1.jpg" />
	<image title="" url="2.jpg" />
</AboutUs>

So I now want this one xml file to be global so depending on what page a user is in, the flash file would use the appropriate XML Tag? (homepage, AboutUs etc)

Thank you for you help in advance.
 
Thanks for that link oldnewbie. I have done that tutorial before. Where my problem lies is having to display relate a section of my xml to a section of my page thats the problem.

thanks for your contribution.
 
Having more than 1 root node might complicate things. Stick your 'section' nodes under a main root node and then say
something like
Code:
rootNode = myxml.firstChild;
pageNode = rootNode.firstChild;
var thisPage = "aboutus";
do {
	if (pageNode.nodeName == thisPage) {
	// The current node of images matches the section you want, do stuff here
	}
} while (pageNode = pageNode.nextSibling);
I may be wrong I'm only starting this stuff myself :)

_________________________________
Leozack
Code:
MakeUniverse($infinity,1,42);
 
Leozack thank you for that post, I think I have duplicated this post... but I want to use variables, how would I do this? is it possible to break it down a bit so I can understand it? I am not that advance, actually my realm is php and mysql I dont really touch flash and xml and the lot so am quiet a novice. i.e where does the code you sent above fit into the puzzle? (sorry if I ask daft question I am just trying to get my head around it.)

Thanks a million
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top