designlevel2
03-24-2004, 01:44 PM
Ok I have a remoting project that needs to load about 50 images per swf. I have the whole thing working, but now im running into preloading issues.
That being said I am readdressing how to achieve this. I think what I need to do is bring all of the file names into a local array, then use setInterval to load them. I have this working fine statically but when I populate the array with remoting it screws up and doesnt work. My question is how do I populate an array locally. Here's my static code that does work:
k=0;
myDummyArray = ['images/naveen.jpg', 'images/cn4.jpg', 'images/mu_med.jpg', 'images/rb_med.jpg'];
i = 0;
//ArrayAll = (myDummyArray[0]+", "+myDummyArray[1]+", "+myDummyArray[2]);
ArrayAll = (myDummyArray[0]+", "+myDummyArray[1]+", "+myDummyArray[2]+", "+myDummyArray[3]+", "+myDummyArray[4]);
totaljpgs = 4;
for(i=0;i<=totaljpgs;i++){
rclip=_root.createEmptyMovieClip("MyClip"+i,i);
rclip.loadMovie(myDummyArray[i]);
rclip._x = (100*i);
rclip._y = 300;
//rclip.loadMovie("images/cn1.jpg");
}
function loadtotalfunction(){
for(i=1;i<=totaljpgs;i++){
total=_root["MyClip"+i].getBytesTotal();
//}
//clearInterval(loadtotalinterval);
preloadinterval=setInterval(preloadfunction,10);
}
}
function preloadfunction(){
for(i=1;i<=totaljpgs;i++){
loaded=_root["MyClip"+i].getBytesLoaded();
}
fractionloaded=(loaded/total);
//percentloaded=loaded;
if (fractionloaded>0){
percentloaded=math.floor(100*fractionloaded)+" %";
}
if(fractionloaded>=1){
clearInterval(preloadinterval);
}
}
loadtotalinterval=setInterval(loadtotalfunction,10 );
Thanks in advance.
That being said I am readdressing how to achieve this. I think what I need to do is bring all of the file names into a local array, then use setInterval to load them. I have this working fine statically but when I populate the array with remoting it screws up and doesnt work. My question is how do I populate an array locally. Here's my static code that does work:
k=0;
myDummyArray = ['images/naveen.jpg', 'images/cn4.jpg', 'images/mu_med.jpg', 'images/rb_med.jpg'];
i = 0;
//ArrayAll = (myDummyArray[0]+", "+myDummyArray[1]+", "+myDummyArray[2]);
ArrayAll = (myDummyArray[0]+", "+myDummyArray[1]+", "+myDummyArray[2]+", "+myDummyArray[3]+", "+myDummyArray[4]);
totaljpgs = 4;
for(i=0;i<=totaljpgs;i++){
rclip=_root.createEmptyMovieClip("MyClip"+i,i);
rclip.loadMovie(myDummyArray[i]);
rclip._x = (100*i);
rclip._y = 300;
//rclip.loadMovie("images/cn1.jpg");
}
function loadtotalfunction(){
for(i=1;i<=totaljpgs;i++){
total=_root["MyClip"+i].getBytesTotal();
//}
//clearInterval(loadtotalinterval);
preloadinterval=setInterval(preloadfunction,10);
}
}
function preloadfunction(){
for(i=1;i<=totaljpgs;i++){
loaded=_root["MyClip"+i].getBytesLoaded();
}
fractionloaded=(loaded/total);
//percentloaded=loaded;
if (fractionloaded>0){
percentloaded=math.floor(100*fractionloaded)+" %";
}
if(fractionloaded>=1){
clearInterval(preloadinterval);
}
}
loadtotalinterval=setInterval(loadtotalfunction,10 );
Thanks in advance.