PDA

View Full Version : Layout Images



xchrisx
10-07-2008, 04:28 PM
Is there a way to determine how many images are in the Image Editor via lscript? I currently am using a while loop to cycle through all the images, but when it gets to the end of the list it just crashes. I also do not see any documentation in the manual about it. Any help would be greatly appreciated.

-c

faulknermano
10-07-2008, 07:49 PM
i'm using this:



generic
{
i=0;
img = Image();
while(img)
{
i++;
img = img.next();
}
info(i);

}


how many images are you using? can you post the code snippet you are using to cycle through the images?

xchrisx
10-08-2008, 12:11 AM
thanks lernie. Below was my general code prior to yours. Yours definitely works so no more headache for me :)

Thanks a bunch.
-c

i = 1;
keepAlive = true;
while(keepAlive==true)
{
imageList[i] = Image(i);
i++;
if(Image(i) == nil)
{
keepAlive = false;
}

}

faulknermano
10-08-2008, 12:17 AM
the reason why your original code is crashing (i suspect), is because, i think, you cannot feed an invalid number to Image(). so if you have 5 images, and then use Image(6), that may result in the crash. using the next() method of the Object Agent ensures that LScript returns the proper image OA, if there's one.