I'd recommend using a Loader and listening for an IO error: var loader:Loader = new Loader(); loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler); var request:URLRequest = new URLRequest(url);
loader.load(request); Then you'll either receive an IO_ERROR - which mean you should use your default image, otherwise you'll receive the COMPLETE event, and you can apply the loader content as your image. On Jan 29, 2008 1:40 PM, <[EMAIL PROTECTED]> wrote: > Ok someone remind me to get a Flex poster at the next meeting. > > Need some logic help in flex. > > Trying to mimic the fileexists from CF directly in flash/flex. > > I have a resultset that has an item id that has to match an image. > I am building the the string like this: > source = 'assets/somedirectory/' + result.id + '.jpg' (works correctly). > > The database is read only and doesn't have any association with the images. > > if match then display, else display default. > > Now I want to check and see if the image is in the directory and display it > if it is. > If not display a default image. > > Tried file reference to no avail. > Surely Flex has a means to look at a directory to see if a file exists. > Most of the blogs and articles I have found have to do with file upload or > download, I just want to see if an image is in a directory or not. > > Any thoughts appreciated. > > > > ------------------------------------------------------------- > To unsubscribe from this list, simply email the list with unsubscribe in the > subject line > > For more info, see http://www.affug.com > Archive @ http://www.mail-archive.com/discussion%40affug.com/ > List hosted by http://www.fusionlink.com > ------------------------------------------------------------- > > > ------------------------------------------------------------- To unsubscribe from this list, simply email the list with unsubscribe in the subject line For more info, see http://www.affug.com Archive @ http://www.mail-archive.com/discussion%40affug.com/ List hosted by http://www.fusionlink.com -------------------------------------------------------------
