Picture based on availalibility
Hi all
how can i change which picture is displayed based on the contents of a folder?
I have numerous jpg images in a folder each one is refrenced using a 13 digit number. there is also a file name NA.jpg. this is th image to be used if a certain file does not exist.
On one frame i have a loop which creates a picture object and then adds a 13 digit id to an alterabl string. in order to make the picture display i have done the following:
File Name: Alt String A (Picture) exists - Set Picture to appdir$+"images\"AltStringA+".jpg"
The abovw works great if the file exists. the problem is though that i cannot get the NA.jpg to display if the file doesn't exist.
anyone got any tips?
Re: Picture based on availalibility
Set every picture to show NA before your loop?
Alternatively, show us the code you've used to make it show the NA.jpg, as that's the bit that's broken it could be useful to show it to us...
Re: Picture based on availalibility
I'll have to type the code out so bear with me:
Bit of background - the picture objects are displayed on an 9x 4 grid
start of frame: Start loop displayy 4 times
on loop displayy start loop displayx 8 times
on loop displayx create picture object
- set picture to appdir$+"images\NA.jpg"
- set alt string a of Picture to 13 digit id (this is retreived from an array and i know this works fine)
- start loop image 1 time
on loop image
+ file alt string a (picture) exists
- set picture to appdir$+"images\"+altsringa(picture)+".jpg"
That works great. If the image doesn't exist though just a blank square is displayed.
I haven't posted my positioning code as it is quite complex and uses counters and other objects. The positioning itself is fine though.
Hope what i have written makes sense
(Note - I have also tried using the If Else object instead of a third loop but that doesn't seem to work.)
Re: Picture based on availalibility
Your last loop doesn't restrict its actions to a single picture object, that could do strange things (like setting all pictures to the same file).
Re: Picture based on availalibility
It doesn't restrict but it still works. each individual picture is displayed correctly it's just the NA picture that isn't.