Hi all,

I am trying to make a photo gallary. I want to load images dynamically and
would like it to stop loading when there are no more files to load. For this
I am using a while loop so that it loads the files till the End of Files.
But the problem is that I don't know what the while loop breaking condition
should be. As I have searched a lot but I cannot find a way to catch the
error if there is no file to load. Can somebody please help me how to break
the while loop if it cannot find the next file. 

I have tried the try...catch...finally block and have tried the
addEventlistener() property too but still cannot find a way to catch the
error. 

Following is the code I am using:

import mx.controls.Loader;
import mx.transitions.Tween;
import mx.transitions.easing.*;

//Global variables
var i = 1;
_global.xvalue = 20;
_global.loadingCheck = 1;

var loaderListener:Object = new Object();
loaderListener.complete = function (evt_obj:Object) {
        _global.loadingCheck = 0;
        trace("Error handled");
};

//Implementation Starts from here
while ("Don't know the condition to put here") {
        this.createEmptyMovieClip("thumbnail_movie"+i, i);
        with (this["thumbnail_movie"+i]) {
                _xscale = 100;
                _yscale = 100;
        }
        this["thumbnail_movie"+i].createClassObject(mx.controls.Loader,
"thumbnail"+i, i);
        with (this["thumbnail_movie"+i]["thumbnail"+i]) {
                autoLoad = false;
                contentPath = i+".jpg";
                addEventListener("complete", loaderListener);
                load();
        }
        i++;
        trace(_global.loadingCheck);
}


Muhammad Sheraz Iqbal
Associate, IT Programs

 <<...OLE_Obj...>>      Hagler Bailly Pakistan
1E, Ali Plaza, Jinnah Avenue, Blue Area 
Islamabad 44000 Pakistan        

Universal Access: (+92 51) 111 HBP TEL, (+92 51) 111 HBP FAX, Cell: (+92
333) 552 1242
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>  

Important Notice: This message, and any attachments to it, is intended
solely for the addressee(s) indicated, and is confidential.  If you have
received this message in error, please delete it and notify the sender
immediately. Any use not in accordance with its purpose, any dissemination
or disclosure, either whole or partial, is prohibited except with receipt of
formal approval.  The Internet cannot guarantee the integrity of this
message, hence Hagler Bailly Pakistan will not be liable for the
consequences of any person acting, or refraining from acting, on information
contained in any associated attachments prior to the receipt of subsequent
written confirmation.

_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to