Skip to main content
Known Participant
September 10, 2007
Question

Preloading in the swf itself AS3

  • September 10, 2007
  • 11 replies
  • 1169 views
Hello guys ;]

I need some help in AS3.

My problem is that I can't preload the content in the swf movie itself.. I mean movie clips and images that are inside the swf not external and so on.

In AS2 All I needed to do is this :

this.onEnterFrame = function() {
loadingAmount = this.getBytesLoaded()/this.getBytesTotal()*60;
if (loadingAmount == 60 and sVars.loaded == true and this.bigPicWidthsScript_mc.wVars.loaded == true) {
this.gotoAndStop(3);
delete this.onEnterFrame;
}
};

This is juat an example what used to work.. I copied this part from a code I wrote time ago in AS2.
So all u had to do is put this code on frame 1 along with some preloading graphics (small size), move all your movie clips u want loaded before they actually show up and start your animation to frame 2 as keyframe, and Put the ones who show up at the start in your movie at frame 3 where you actually go when preloading is finished.

So I want to do the same thing in AS3.. I've found tutorials about preloading swfs images and so on but I don't need that.. I need this one here.. so does anyone have any idea how to do that ?

I will be very grateful !

Waiting for replies,
Filip Nedyalkov
Also u had to set Export frame for classes = 2 (in the publish settings),
This topic has been closed for replies.

11 replies

kglad
Community Expert
Community Expert
September 10, 2007
use your loader's loaderInfo property's bytesLoaded and bytesTotal properties in an as3 loop (ENTER_FRAME or timer). there may be problems with setInterval() in as3.
FlamebgAuthor
Known Participant
September 10, 2007
thanks kglad,
but can you be more specific please..

I am not using any loader because I don't want to load the same swf in itself..
I just didn't understand what you tried to explain to me, maybe you can write me an example just like I did on AS2 please ?
In Flash Help I couldn't find anything about bytesLoaded and so on.. in the examples there they show how they create loader and load the swf in it.. but I don't want to make separate flash with just one loader in it so I can load my actual swf with preloader..
I don't know if you understand what I am trying to say but I hope u do..

Waiting for more detailed reply,
Filip Nedyalkov