View Full Version : Loading external text in to two movies
simontheak
09-14-2002, 01:49 PM
Ok - it's not a great title ...
But the problem is that I have one main movie which loads various other swf files into a movie clip when different buttons are pressed.
Here's where it starts to get complicated. In one of these external files, I am loading text from an external file into a dynamic text field placed inside a movie clip. This works fine when I run this file by itself.
However, the problem occurs when I try and load this swf into the main movie. All I get is some kind of a path instead of the text I should be receiving:
_level0.container.holder.cv
Any idea why this is?
sumul
09-14-2002, 02:58 PM
There are a few things that could be causing something like this. The first one that always comes to mind for me is directory structure.
Are all of your movies and text files in the same directory? If not, then you must write all URLs relative to the main movie. This means that the sub-movies will not work when you play them alone, but they will work fine when you load them into the main movie.
For example, if your directory structure looks like this:
- Flash folder
|
+ pictures folder
- movies and text folder
| |
| - movie1.swf
| - movie2.swf
| - text1.txt
| - text2.txt
- main.swf
then you'd be loading text1.txt into movie1.swf by saying something like this.loadVariables("text1.txt"), right? No, that's incorrect. Since movie1.swf is in turn going to be loaded into main.swf (and therefore becomes part of its timeline), you have to load text1.swf into movie1.swf by saying something like this.loadVariables("movies and text folder/text1.txt") even though they're in the same folder.
Anyway, sorry if this isn't your problem.
Good luck
Jon B
09-14-2002, 03:18 PM
if you sort this then let me know please - i have posted a similar problem in the actionscript forum. I have checked my directory structure and it's all correct, i think it must be something to do with getting the referencing right. You know like when you have to control a movie clip above your current movie clip all in the same movie - well i figure this is the same only with swfs instead of MCs - I can't sort it but i hope someone can.
mcdanyel
09-14-2002, 04:31 PM
I had a similar problem and just got lazy and put the complete URL in the load command. Works fine, just a little more typing. So if your text file is called "text1.txt" and is some folder somwhere on your server named "textFiles" then you could be lazy and put the whole thing in there on your load command like "http://www.yourWebSite.com/textFiles/text1.txt"
Not very scripting savvy but if all else fails...
Jon B
09-14-2002, 10:01 PM
ok thanks, but that didn't work, but i think i'll have the problem sorted with a little help from you guys.
i think it's to do with the fact that each swf subsection to my site is loaded into an empty MC on the main timeline of the main site. Now i figure that every link to external files must be be in the form of it's location relative to the main timeline - the way i have it at the moment means that it is looking for the txt file relative to the position of the MC not the timeline which holds the MC. Make sense?
ok - whilst writing this message i have been fiddling and I'VE DONE IT!
:D I'VE DONE IT!!!!!! :D
the reference to the file is as follows:
loadVariables("text/links.txt", "_root.EmptyMC");
_root - the link to the main movie
EmptyMc - the empty MC on the main movie timeline that I load the subsections into
hope this helps any of you guys
simontheak
09-15-2002, 09:25 AM
So what are you saying? That the text needs to be loaded in to the movie clip on the main timeline rather than the movie clip in the second swf file?
Jon B
09-15-2002, 12:12 PM
essentially yes - what you have to remember is that all external files have to be located in relation to the main timeline on the main movie - so whilst the actionscript to load the text file goes in the swf you load into the main movie, the target for this text file has to be the same place the swf gets loaded in your main movie - in my case i loaded my swf into a empty MC on the main timeline of the main movie - that is why my link is _root.EmptyMC if you loaded the swf into a level rather than a target on your main timeline then i guess that you would only need _root, altho you may need to specify the level somehow.
I'm not really the best at explaining this, but if anybody can understand me and knows how to explain better then please try.
Hope your movie works too.
N.B. remember that now you have located the text file in relation to main movie the swf will no longer be able to load the text file if you run it on it's own - it will only work when you run it from the main movie.
simontheak
09-16-2002, 08:14 AM
I think I'm being silly here ... but I'm not quite sure I understand!
My setup is this:
On the main movie, I have a blank movie clip called 'container'
In to this I want to load an external swf file called 'contact.swf'
The file contact has another blank movie clip in it called holder in to which I'm loading the text file contact.txt externally.
With this in mind, can you tell me how I need to adapt my code becuase I've been trying ... but without any luck!:mad:
simontheak
09-16-2002, 10:03 AM
It's ok - don't worry ... I've got it all sorted out now.
Thanks for everyone's time though!
Jon B
09-16-2002, 03:01 PM
:D YAY! :D
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.