Passing xml files to swfs?

Hi, Thanks for taking the time to look at my thread, I hope the title of this thread wasnt too confusing but here’s what Im TRYING to achieve…

Ive searched the forums, but im puzzled. Can someone talk me through this please…

I have a main movie with a dynamically created menu (uses data gathered from an XML file). Each menu item has an Action and Variables associated with this action.


<?xml version="1.0"?>
<menu name="mainmenu">
	<item name="Home" action="gotoURL" variables="http://www.something.com/index.html"/>
	<menu name="Gallery">
		<item name="graduation" action="loadSlideShow" variables="graduation.xml"/> 
	</menu>
	<menu name="Links">
		<item name="Google" action="gotoURL" variables="http://www.google.com"/> 
	</menu>


(snippet of related functions in AS)
Actions = Object();
Actions.gotoURL = function(urlVar) {
	getURL(urlVar, "_blank");
};
Actions.loadSlideShow = function(dataFileName){
	var = "photoGallery.swf"+dataFileName;
	loadMovieNum(var,"content_mc","POST");
};

Now as you can see from my XML file above one of my menu options is a photo gallery. What I would like to to is have one swf, i.e. photoGallery.swf, and load this into an empty movie clip called content_mc and pass it different XML files (same format, but different content). (see my loadSlideShow() function)

Can anyone give me any ideas on how to do this?

I see no menu when testing your file :-/

I see in the code that your movieclip is loaded when the gallery button is pressed, but that’s kinda hard to do if there is no gallery button …

You said you wanted different XML to be loaded in the gallery text. What XML data is that ?

Oh darn in the transfew from MX pro 2004 to MX I lost all the synmbols and forgot to replace them :(. Here’s my attachment again, and ive tested it this time :wink:

Hi again, im still having great trouble with this. Please help…

Basically all im looking for is some help with creating a loading function (a prototype) which passes variables to the swf movie to be loaded. Any ideas ?

Your help greatly appreciated :cowboy:

Yeah, sorry, been away for a while.

I still see no menu and your library is empty :-/

:stunned: .yer I wouldnt mind getting away myself…I dont understand why you dont see the menu !? Im using MX ?? I mean the file was originally MX 2004, but i fixed and tested it…Hmm lemme me check again …

I don’t know what happened, but your library was completely empty.

I’ve got MX 2004, can you send me the 2004 file ?

You should get the menu in this version…

Check your pms.

But voets, did you fall asleep on your biology class?
Boys don’t have PMS, only girls do! :smiley: :trout:

Lol :stuck_out_tongue: Just wanted to chat about this, doing this on the forum would be kinda … unsuitable.

Anyway, mindfriction – I used an object stored in _root to transfer data from the one swf to the other. I would’ve done it another way, but there was some trouble with load delay and for some reason, my onEnterFrame handler which I used to check when it has completed loading was ignored. So here they are.

They’re in MX 2004 format, to ensure no data loss.

Thanks Voet’s i’ll take a look mate :thumb:

Ok well I see how it works with an obj in _root…


Actions.showSlides = function(slidesxml) {
	_root.transfer = new Object();
	_root.transfer.xmllink = "file.xml";
	_root.content_mc.loadMovie("gallery.swf");
};


… But you mentioned there was another way? What might that be?..Im curious because im trying to limit the use of _root and global vars/ objs if you know what I mean ;), I would rather pass it as some sort of argument to a method or something like that…

Thanks for your help anyways :slight_smile:

Well, the other way is passing the variable directly to the loaded movieclip using this for example:


Actions.showSlides = function(slidesxml) {
_root.content_mc.loadMovie("gallery.swf");
_root.content_mc.xmllink = "yourfile.xml";
};

But that didn’t work, because there is a delay between the loadMovie command and the moment at which the external movie is loaded and executes the command that sets the xmllink value in the textbox. You are basically setting the external movie’s xmllink property when it hasn’t loaded yet.

So I figured this can be solved by using an onEnterFrame handler to check when getBytesLoaded and getBytesTotal are equal, and then set whatever variable you like. But for some reason, the onEnterFrame handler got ignored. So I did it that way.