Go Back  HTML Forums - Free Webmaster Forums and Help Forums > WEBSITE DEVELOPMENT > Flash Development
User Name:
Password:
 

Reply
Thread Tools   Display Modes
  View First Unread
 
Old 05-05-2008, 05:29 AM
  #1
tomjelfs
Myrmidon (Level 12)
 
Join Date: Oct 2003
Location: Cheltenham UK
Posts: 173
iTrader: (0)
tomjelfs is on a distinguished road
Preloading external SWF files

Hi

I'm currently using this actionscript


Code:
bytes_loaded = Math.round(this.getBytesLoaded());
bytes_total = Math.round(this.getBytesTotal());
getPercent = bytes_loaded/bytes_total;
this.loadBar._width = getPercent*100;
this.loadText = Math.round(getPercent*100)+"%";
if (bytes_loaded == bytes_total) {
	this.gotoAndPlay(10);
}
to preload whenever I need preloading on a file but I've just put together a piece of flash for a website that loads external swf files by using

Code:
_root.movieloader.loadMovie("paulnicholls.swf");
when it hits a certain frame.

What I want is for the main file to look at all the other flash files and then preload them before starting, is this possible?

Cheers
__________________
Tom

My questions might not make any sense but at least they are interesting.
tomjelfs is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 05-05-2008, 07:30 AM
  #2
RysChwith
Super Guru
 
Join Date: Jun 2004
Posts: 3,866
iTrader: (0)
RysChwith will become famous soon enough
Yup. Just change this.getBytesLoaded() to movieloader.getBytesLoaded() (and so on for the other functions).

You also need to change your if statement to:
Code:
if( bytes_loaded > 4 && bytes_loaded >= bytes_total ) {
An empty movie clip -- one that has not yet begun to load its contents -- takes up four bytes. If you don't check for that, your if statement can evaluate to true before anything has loaded.

Rys
RysChwith is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 05-05-2008, 09:00 AM
  #3
tomjelfs
Myrmidon (Level 12)
 
Join Date: Oct 2003
Location: Cheltenham UK
Posts: 173
iTrader: (0)
tomjelfs is on a distinguished road
Thanks for your reply.

So my code should look like this?

Code:
bytes_loaded = Math.round(movieloader.getBytesLoaded());
bytes_total = Math.round(movieloader.getBytesTotal());
getPercent = bytes_loaded/bytes_total;
movieloader.loadBar._width = getPercent*100;
movieloader.loadText = Math.round(getPercent*100)+"%";
if( bytes_loaded > 4 && bytes_loaded >= bytes_total ) {
	this.gotoAndPlay(10);
}
And then when my movie reaches the frame where I call the movie it should load instantaneously.

because if so that's not working.

Any ideas or am I going the right way about if?

Cheers again.
__________________
Tom

My questions might not make any sense but at least they are interesting.
tomjelfs is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 05-06-2008, 07:25 AM
  #4
RysChwith
Super Guru
 
Join Date: Jun 2004
Posts: 3,866
iTrader: (0)
RysChwith will become famous soon enough
Well, you still need to tell it to actually load the movie, either by placing its symbol (if it's in your library) on the stage or by using the loadMovie() method.

Rys
RysChwith is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 05-08-2008, 02:58 AM
  #5
tomjelfs
Myrmidon (Level 12)
 
Join Date: Oct 2003
Location: Cheltenham UK
Posts: 173
iTrader: (0)
tomjelfs is on a distinguished road
Well I was telling to load the movie. So at frame 1 is the preloader then that moves to frame 10 where a transition effect is currently being executed and at frame 10 I have the loadmovie() command, but there is still a gap before it appears.
__________________
Tom

My questions might not make any sense but at least they are interesting.
tomjelfs is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Reply
« Previous Thread | Next Thread »


 
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
  
 
 
 



 
  POSTING RULES
 
 
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Thread Tools
Display Modes

Forum Jump

 

All times are GMT -5. The time now is 10:59 AM.

   

Mascot team created by Drawshop.com

Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.

Server Monitoring by ENIACmonitor 0.01
HTMLforums.com © Big Resources, Inc. Web Design by BoxedArt.com
vRewrite 1.5 beta SEOed URLs completed by Tech Help Forum and Chalo Na.