# Loading swf (which has its own preloader)

**URL:** <https://forum.kirupa.com/t/loading-swf-which-has-its-own-preloader/7133>\
**Category:** flash\
**Created:** [October 24, 2002, 12:29pm UTC](https://forum.kirupa.com/t/loading-swf-which-has-its-own-preloader/7133 "2002-10-24T12:29:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pjc4real](https://avatars.discourse-cdn.com/v4/letter/p/58f4c7/32.png) [@Pjc4real](https://forum.kirupa.com/u/Pjc4real)\
**Post date:** [October 24, 2002, 12:29pm UTC](https://forum.kirupa.com/t/loading-swf-which-has-its-own-preloader/7133/1 "2002-10-24T12:29:18Z")

</div>

In my main movie, I am trying to load a welcome section (“welcome.swf”) into a blank movieclip (instance name: contents)

Now, welcome.swf has its own simple preloader. When I test the movie (welcome.swf) on its own, its fine - the little preloading animation shows. However, when trying to load it from the main movie, all I get is a brief glimpse of the preloader animation then MY MAIN MOVIE RETURNS TO THE BEGINNING AGIN - AND KEEPS LOOPING!!

Here’s my code:

SCRIPT TO LOAD WELCOME SECTION ON MAIN MOVIE TIMELINE:

\_root.contents.loadMovie(“welcome.swf”);

PRELOADER SCRIPT FOR WELCOME.SWF

total = \_root.getBytesTotal();  
loaded = \_root.getBytesLoaded();  
if (loaded\>=total) {  
\_root.gotoAndPlay(32)  
}

Why is it not working???

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 24, 2002, 12:36pm UTC](https://forum.kirupa.com/t/loading-swf-which-has-its-own-preloader/7133/2 "2002-10-24T12:36:45Z")

</div>

I think you should try this code

total = \_root.contents.getBytesTotal();  
loaded = \_root.contents.getBytesLoaded();  
if (loaded\>=total) {  
\_root.contents.gotoAndPlay(32)  
}

or

total = this.getBytesTotal();  
loaded = this.getBytesLoaded();  
if (loaded\>=total) {  
this.gotoAndPlay(32)  
}

may be any one of these code will work

* * *

Ranish
