Question regarding the "Creating a Preloader and Progress Bar" tutorial

I’ve done the tutorial in the topic-title and it’s great and easy to understand. I do have one question though:

Right now, the image I load using the tutorial loads really fast (it’s only 240kb) which basically means that the progress bar just blinks and completes so fast that people who don’t know what’s going on won’t know what just blinked.

My question therefore is this:

Is it possible to tell the preloader, that even if the image is already loaded, the progress bar will take for example 2 seconds to complete?

That way people with fast connections will see the preloader for 2 seconds and people with slower connections will see the preloader for whatever time it takes to load the image.

Here’s the code from the tutorial:

var imageLoader:Loader;

function loadImage(url:String):void {
// Show Preloader
     preloader_projekt1.visible = true;
    
// Set properties on my Loader object
    imageLoader = new Loader();
    imageLoader.load(new URLRequest(url));
    imageLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, imageLoading);
    imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded);
}
loadImage("projekt1.png");

function imageLoaded(e:Event):void {
// Load Image
    mc_projekt1.addChild(imageLoader);
// Hide Preloader
    preloader_projekt1.visible = false;
}

function imageLoading(e:ProgressEvent):void {
// Get current download progress
    var loaded:Number = e.bytesLoaded / e.bytesTotal;
// Send progress info to "preloader" movie clip
    preloader_projekt1.SetProgress(loaded);
}

Thank you :slight_smile: