How can i play an external movie only if it is loaded

the thing is like this.I have 2 swf files which are loaded in the main swf.How can i make a preloader for them inside the main swf to display how much of the other swf has been loaded?Without adding a second scene…I was thinking about a dynamic text field that should display how much has been loaded for each movie.Unfortunately i don’t know how to da that.I have tried the code like this but it doesn’t work:
per_fractal = Math.Floor(getbytesloaded(fractal.swf)*getbytestotal(fractal.swf)/100);
Myoutput.text = “per_fractal” + " %";

the script is like this:

but.onPress = function () {
_root.createEmptyMovieClip(“container”,1);
loadMovie(“fractal.swf”,“container”);
container._x = -50 ;
container._y = 285.9;
container._alpha = 0;

}

accel = container._alpha + 1/2;
onEnterFrame = function() {
container._alpha = container._alpha + accel;
}

but2.onPress = function(){
_root.createEmptyMovieClip(“container”,1);
loadMovie(“face.swf”,“container”);
container._x = -50 ;
container._y = 285.9;
container._x = 170;
container._y = 232;
container._alpha = 0;
}

Ok … I haven’t tried this but now that I think about it, this should work:

  1. In the movie you want to display a preloader for on the host swf, make two extra keyframes at the very beginning of the timeline (frame 1&2).

  2. To the first keyframe, add a new mc (CTRL+F8, don’t forget to drag it from the library onto the stage after using CTRL+F8) and apply following code to it (to the mc that is, not the keyframe):

[AS]onClipEvent(enterFrame){
_root.extloaded = _parent.getBytesLoaded();
_root.exttotal = _parent.getBytesTotal();
if (_root.continue == true){
gotoAndPlay(frametostartmovieat);
}
}[/AS]

  1. To the second keyframe, add this as:

[AS]gotoAndPlay(1);[/AS]

  1. Now for your host movie. I suggest you use a preloader from the tutorial here on kirupa. It’ll make it easier to understand what’s going on. Find it hereWhen you’re done setting it up, replace the code with this:

[AS]getPercent = _root.extloaded/_root.exttotal;
this.loadBar._width = getPercentwidthofyourloadbar;
this.loadText = Math.round(getPercent
100)+" %":
if (_root.extloaded == _root.exttotal){
_root.continue = true;
this.gotoAndPlay(3);
}[/AS]

That should do it. If it doesn’t, please pm or mail me and I will check to see what’s wrong.

well,i don’t have time to see if it work right now couse i’m on my way home(after a long night at work) but i’ll try it first time in the morning.Anyway it’s quite easy to make it with keyframes but my problem is that i have made the movie in such a way that if i add keyframes my code will not work…
thanks anyway