NaN% error - use of photo gallery for .swf

Hi, i am trying to get the photo gallery made by flashmo available here: http://www.flashmo.com/preview/flashmo_025_photo_xml

to display .swf instead of external .jpg files as it was originally intended for. This system is .xml based where it obtains details of the images to display from the external .xml file.

I have the system working for the photo gallery but i need a page where a show animations that are already compiled into self contained .swf files. The site I am building if purely flash and consists of just one main.swf file.

To get the system to work I simply changed the filename in the .xml file to direct the system to a .swf animation file as oppose to a .jpg file and the system worked perfectly. oh so i thought…

Testing the site within flash under the “test movie” (ctrl + enter) option proved the system to be fully functional with no issues at all. However when exported as a flash .swf movie file as a standalone file when ran locally through directly clicking on the .swf the animations page would simply display “NaN%” where the percentage loaded should be displayed and clicking on the thumbnails to load different .swf movie files didn’t do anything, the .swf animation files will never load, nothing is ever shown apart from the empty loading bar and “NaN%”. Loading the .swf locally through the browser by means of a simple html page doesn’t make a difference either.

To make it a little more strange, when the site was uploaded to an online server and visited remotely through the browser it would do the same but clicking on the thumbnails loaded the corresponding .swf animation file fine and the “NaN%” error after the initial display is never seen again until the browser is closed and re-opened to visit the site again. The system is set to initially load the first .swf animation clip.

The code for the loading is:

[SIZE=1]pic._alpha = 0;
pic.loadMovie(filepath + photo_filename[p]);
pic_desc.txt = photo_description[p];[/SIZE]
[SIZE=1][/SIZE]
[SIZE=1]old_p = p;[/SIZE]
[SIZE=1][/SIZE]
[SIZE=1]preloader._width = 0;
[/SIZE][SIZE=1]preloader._visible = true;
preloader_bg._visible = true;[/SIZE]

[SIZE=1]preloader.onEnterFrame = function()
{
percent = Math.round( pic.getBytesLoaded() / pic.getBytesTotal() * 100 );

if( percent == “NaN” )
percent = 0;

txt = percent + “%”;
preloader._width = percent * 3;

if( percent == 100 )
{
txt = “”;
preloader._visible = false;
preloader_bg._visible = false;
play();
delete this.onEnterFrame;
}
else
{
gotoAndStop(“start”);
}
}[/SIZE]
[SIZE=1][/SIZE]
The full code for the system and its workings can be downloaded at:
[COLOR=#810081]http://www.flashmo.com/preview/flashmo_025_photo_xml[/COLOR]

Only minor changes to the code have been made by me and I am no expert at this at all so it could be something really simple. I feel the fact that it works under testing, partially when online and not at all when run directly and indirectly (browser) locally is strange and there must be an explanation for this that one of you experts must know.

Any help with this would be greatly appreciated - thanks very much

Liam

Hmmm I checked your url and everything work great, except the annoying “NAN%” message.

My advice is to use the moviecliploader class instead of this deprecated code (bytesloaded, etc).

Depending on your schedule you can also use an ugly solution such as


if(percent == "NAN%"){
 txt = "";
}

Hi, thanks for the reply, i see what you trying to achieve with that code but is there not something already in place to do something similar but it changes the “percent” variable into a “0” in the code shown below:

if( percent == “NaN” )
percent = 0;

txt = percent + "%";
preloader._width = percent * 3;

Have you any more info on the moviecliploader class as you say this will work? I am on a pretty tight schedule as i am needing the site fully functional asap. Any simple adapation in code to the flashmo system that will enable it to show external .swf files with full success?

cheers guys