WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Site Design > Flash Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Flash Discussion Forum Flash design presents a limitless number of possibilities for your sites and designs. Discuss your Flash ideas, questions and issues here.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-12-2004, 01:27 AM
WebProWorld Member
 

Join Date: Aug 2003
Location: Jersey City, NJ
Posts: 71
jazzmatazz2005 RepRank 0
Default Loads but don't pre-loads

when users come to my site i want a different Flash movie to load. The action script that im useing is
Code:
filename = ["mainarea.swf", "mainarea2.swf",  "mainarea3.swf"];
path = "http://www.rockdamic.com/main/animation/";
i = filename.length;
k = Math.floor(Math.random()*i);
loadMovie(path+filename[k], movieTarget);
The problem is i already have the flash movies created and they all have preloaders but when the action script call for the movie it doesn't preload all i get is a hugh white box and then finally the movie shows up. I wan it to preload. Do anyone have any ideas on how i can fix this.
__________________
It's better to do business with me than against me!
Reply With Quote
  #2 (permalink)  
Old 09-27-2004, 09:13 AM
WebProWorld Member
 

Join Date: Aug 2003
Location: UK
Posts: 77
poab RepRank 0
Default

Hi,

The problem you are having is that a movie clip will only play when it is fully loaded. In other words, your preloader scripts are running, but they don't run until the entire thing is loaded, meaning that the getBytesLoaded() and the getBytesTotal() (I assmue that's how you're doing it) are already equal and therefore the preloader animation doesn't show.

What you need to do is remove the preloaders from the movies you're loading (they're worthless where they are) and put the preloader into the main swf.

I'm not going to go into the onData and onLoad event handler debacle but they're useless to you here so don't bother with them. If you search for them you'll find plenty of info.

Basically here's roughly what you need (you'll need to tailor it - it's AS1.0).

filename = ["mainarea.swf", "mainarea2.swf", "mainarea3.swf"];
path = "http://www.rockdamic.com/main/animation/";
i = filename.length;
k = Math.floor(Math.random()*i);
loadMovie(path+filename[k], movieTarget);
pauseloader = setInterval(loader, 500);
function loader(){
var lb = movieTarget.getBytesLoaded();
var tb = movieTarget.getBytesTotal();
trace("bytes loaded = " + lb);
trace("bytes total = " + tb);
if(lb>=tb){
clearInterval(pauseLoader);
}
}

cheers.
Reply With Quote
Reply

  WebProWorld > Site Design > Flash Discussion Forum
Tags: , ,



Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On


Search Engine Optimization by vBSEO 3.2.0