Preloading external swfs problem again

Fine fine…I know it’s been asked too many times. But my problem is kinda different. All I want to know is: To preload external swfs, should I make a preloader within the swf or should there be a preloader in the parent movie calling the external swf?

Well, all the external swfs I’ve made so far have their own preloader and it works fine when they run independently. The trouble comes when the main movie calls it. The preloader simply doesn’t run. The screen just shows the bg color for few seconds and loads the new content…[content size 30-40k]

for those who think this question’s been asked too many times

Well I searched and got links talkin about some sorta movie linkage and attach movie and dunno what…but I was looking forward in doing something far much simpler than those…I mean…if the preloder works independently for each swf, why shouldn’t it when a parent movie calls it!!!

Thanks in advance…

You are probably using _root in the preloader script of the external swfs. Can you give us the preloader code you used ?

Heres one script that uses a preloder only on the main movie:

//objects on stage:
//inside the parenthesis is the instance name
//empty movie clip (holder)
//textfield - (myTextField)
//loadbar movie clip - (loadBar)
//load bar border movie clip - (border)
loadBar._visible = false;
border._visible = false;
loadClip = function (clip) {
	holder.loadMovie(clip);
	preload();
};
preload = function () {
	this.createEmptyMovieClip("temp", 1000);
	temp.onEnterFrame = function() {
		var t = holder.getBytesTotal(), l = holder.getBytesLoaded();
		if (t && !isNaN(t)) {
			loadBar._visible = true;
			border._visible = true;
			var percent = Math.round(l*100/t);
			if (l == t) {
				myTextField.text = "Done";
				loadBar._visible = false;
				border._visible = false;
				this.removeMovieClip();
			} else {
				myTextField.text = +percent+" %";
				loadBar._width = (l/t)*100;//100 is the loadbar width
			}
		}
	};
};
//usage
mybutton.onPress = function() {
	loadClip("yourfile.swf");
};

Heres a sample fla

I guess you’re right…anyway…here’s the code…

[AS]

// Action script…

// [Action in Frame 1]
tellTarget(“Preloader”)
{
gotoAndPlay(Math.round(_root.getBytesLoaded() / _root.getBytesTotal() * 100))
} // end of tellTarget

// [Action in Frame 2]
if (_root.getBytesLoaded() == _root.getBytesTotal())
{
gotoAndPlay(3);
}
else
{
gotoAndPlay(1);
} // end if

// [Action in Frame 12]
stop();

[/AS]

not to jump off the thread here but Tell Target really doesn’t serve any purpose anymore, it’s just not needed, clauido great script, you amaze me

*Originally posted by Voetsjoeba *
**You are probably using _root in the preloader script of the external swfs. Can you give us the preloader code you used ? **

Voetsjoeba, I tried what you said. But the script is made in such a way, I HAVE to use _root in the external movie…So what do i do? I want to know how to successfully make an external swf preload itself when called by a main movie…

Claudio…I checked the fla but…I think it’ll take time for me to implement that lot to my current structure I have…Right now, I gotta get the current structure working…and that’s simply by making the external swfs preload properly…know any way apart from removing the ‘_root.’ statement?

Why do you have to use _root ?