PDA

View Full Version : swf preloader


Cian
09-26-2009, 02:54 PM
Hello all.
Well I finally got my head around dreamweaver and got my site up and running.
I have uploaded two swf files on the home page and engineering page.
The file size for both are around 1.9 mb (is this ok for the average connection?)
As the files take a few seconds to load it slows down the rest of the page. I want to add a preloader so I watched a few tutorials over at lynda.com (http://www.lynda.com) but Im still having trouble.
I moved all frames over 1 frame and added dynamic text (0%) and then added the code below under the actions tab.
When I test the movie it shows 0% for one frame and then the movie starts loading.
Any ideas. thanks in advance.

Cian.

My website: www.cmgdesigns.ie (http://www.cmgdesigns.ie)

stop();

//Preloader
LoaderInfo.addEventListener(ProgressEvent.PROGRESS , updatePrelaoder) ;

function updatePrelader(evtobj:ProgressEvent) :void
{
//container for the progress of the video (download)
var percent:Number=Math.floor((evtobj.bytesLoaded*100)/evtesTotal);
preloader_txt.text=percent+"%";
if (percent==100) {
nextFrame();
}
}