Complex problem: loading external text in a re-used SWF

Hey guys,

I’ve got a rather complex problem here. It’s a rather long story, but i’ll try to explain it as short and as clear as possible.

I’m working on a site for a client. On each page there’s a Flash header, in which it loads a JPG and a TXT externally. It all works fine and all, but I want to re-use the exported SWF for each page, without changing the location of the JPG and TXT.

I managed to get it working for the JPG by changing my code from


container.loadMovie()

to


container.loadMovie(img)

in the FLA and changing the code in the PHP which holds the SWF from


<embed src="flash/header.swf">
<param name="movie" value="header.swf">

to


<embed src="flash/header.swf?img=home/header.jpg">
<param name="movie" value="header.swf?img=home/header.jpg">

Basically, all i need to do is open the same SWF in each PHP, but by adding some coding to specify the content of the Flash header.

My problem arises when i want to do the same for the externally loaded TXT. The coding is based on the tutorial on Kirupa and looks like the following:


onClipEvent(load) {
	loadText = new LoadVars();
	loadText.load(txtFile);
	loadText.onLoad = function(success) {
		if(success) {
			headerText.html = true;
			headerText.htmlText = this.Content;
		}
	}
}

This code is applied a movieclip “containerText” which is in another movieclip “info_mc”. My original plan was to change my code in PHP to:


<embed src="flash/header.swf?img=home/header.jpg&txtFile=home/content.txt">
<param name="movie" value="header.swf?img=home/header.jpg&txtFile=home/content.txt">

But unfortunately, it didnt work. Since the code is not applied in to a movieclip in the root, i thought maybe i should get the path right and change it to:


<embed src="flash/header.swf?img=home/header.jpg&info_mc.containerText.txtFile=home/content.txt">
<param name="movie" value="header.swf?img=home/header.jpg&info_mc.containerText.txtFile=home/content.txt">

I’m afraid that was just naive thinking, cos that didnt work for me either. Does anyone has an idea how I could get this working? It would be very appreciated!

Thanks for anyone for reading this long post and paying attention to it.