MX - Preloader AS Problem

I have a preloader in this file which is supposed to check whether the external swf has been loaded into the movie clip “placeholder” and if it is, goto and play frame 3 of the movie clip. It doesn’t work. How come? I know the preloader code works, it displays 100 percent and the load bar and text fields all display what they are supposed to but it doesnt go to frame 3. any help appreciated.

when you have a preloader for an swf loaded into a movie clip, if you use _root.getBytesLoaded() etc… it’ll be referring to the root… try using this.blah blah and that worked for me. when loading swf’s into clips of movies like on this site I’m working on. I can send you the code if you’d like.

I added a keyframe but it still doesnt work :frowning: And I am using this instead of _root.

You don’t have a keyframe at frame 3. That’s why the actions from frame 2 ( gotoAndPlay(1) ) will be executed when entering frame 3. But there is no preloader code which tells flash to go to frame 3 when fully loaded at frame 1, so it will just continue to frame 2. Which will then go to frame 1, which then plays 2, which then plays 1 again. So you are in an infinite loop.

You can see this by looking at the Ouput window. I don’t have the SWF which is supposed to load, and my Output window says:

Couldn’t find Home.swf
Couldn’t find Home.swf
Couldn’t find Home.swf
Couldn’t find Home.swf

That is because it keeps going to frame 1 which calls Home.swf.

oops. my bad i forgot to include it. here is home. and even though i added a keyframe at frame 3 it doesnt work. hmm. i think i know what the problem might be thanks to your wonderful explanation :slight_smile: If i keep the load call on frame one and move the preloader loop to frames 2 and 3, going to frame 4 when loaded, that should work right? The problem now is every time it loops back to frame 1 it tries to reload the file. Ill try that. Thanks

bam it works. Thanks a lot Voetsjoeba :slight_smile:

You’re welcome :slight_smile:

I cant see why your preloader script is in a movie clip that your loading an external swf into. I really looks like your confused.

But anyway, if you want to go to frame 3 then in your ‘if’ condition in your preloader code in your placeholder movie clip just delete the ‘_parent’ and you’ll see it goes to frame 3.


I moved it to the movie clip to see if it worked there because it didnt work on the timeline. Im moving it back now which makes more sense. You are right it looks very convoluted. I am in the process of fixing it.