Preloading external swf into movieclip

  • genius
  • Newbie
  • Newbie
  • User avatar
  • Posts: 12
  • Loc: San Antonio, TX

Post 3+ Months Ago

Here's another preloader question to add to all the rest of them.

I have an external swf file with it's own preloader that I am trying to load into a movieclip of another swf. The code for the preloader is as follows:

Code: [ Select ]
totalBytes = Math.round(getBytesTotal() / 1024);
loadedBytes = Math.round(getBytesLoaded() / 1024);
percentDone = Math.round((loadedBytes / totalBytes) * 100);
if (_root._framesloaded >= _root._totalframes) {
gotoAndPlay("start");
}
  1. totalBytes = Math.round(getBytesTotal() / 1024);
  2. loadedBytes = Math.round(getBytesLoaded() / 1024);
  3. percentDone = Math.round((loadedBytes / totalBytes) * 100);
  4. if (_root._framesloaded >= _root._totalframes) {
  5. gotoAndPlay("start");
  6. }


This code works fine when I play the restaurants.swf file by itself but when I try to load it into my control_panel it doesn't load at all.

The code to load the restaurants.swf file into the movieclip is as follows:

Code: [ Select ]
on(release) {
    loadMovie("restaurants.swf", "crit_content_tg");
}
  1. on(release) {
  2.     loadMovie("restaurants.swf", "crit_content_tg");
  3. }



Without the preloader code everything works fine so I'm at a loss at what I need to do. Also, everything works great offline but when I upload it to the site I start having these problems.


Here is the link for the restaurants.swf by itself (preloader works fine):
http://www.sacritic.com/new/test2.html

Here is the link to the control panel (preloader doesn't work-file hangs)
http://www.sacritic.com/new/test.html

(You'll need to click on the critiques button and then the restaurants button)

My gues is that the _root is screwing me up so I tried _parent and that totally killed it.

Any ideas will be appreciated.

Thanks

Gene
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • B.Rich
  • Newbie
  • Newbie
  • User avatar
  • Posts: 5

Post 3+ Months Ago

Try this:

Code: [ Select ]
totalBytes = Math.round(this.getBytesTotal() / 1024);
loadedBytes = Math.round(this.getBytesLoaded() / 1024);
percentDone = Math.round((loadedBytes / totalBytes) * 100);
if (loadedBytes == totalBytes) {
gotoAndPlay("start");
}
  1. totalBytes = Math.round(this.getBytesTotal() / 1024);
  2. loadedBytes = Math.round(this.getBytesLoaded() / 1024);
  3. percentDone = Math.round((loadedBytes / totalBytes) * 100);
  4. if (loadedBytes == totalBytes) {
  5. gotoAndPlay("start");
  6. }
  • genius
  • Newbie
  • Newbie
  • User avatar
  • Posts: 12
  • Loc: San Antonio, TX

Post 3+ Months Ago

Thanks for the idea but that didn't work either. Taking out the if statement
kept it from loading all together. Hmmm...any more ideas out there?
  • genius
  • Newbie
  • Newbie
  • User avatar
  • Posts: 12
  • Loc: San Antonio, TX

Post 3+ Months Ago

Ok everyone I solved it. I took the _root out of the if statement so it
now looks like this:

Code: [ Select ]
if (_framesloaded >=_totalframes)


Wow, I would think that this wouldn't work since I am not spelling
out a path but it works now so I ain't complaining.

On the flip side I also had to change the code on the status bar to
show _parent instead of _root (but it's a nested MC so that makes
sense).

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 17 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.