Reputation: 95
I would like to check if the file exists and if not display noimage.gif. The below is returning false in the console, can you help?
...
[Bindable]
private var imageName:String;
imageName = "pca" + this._product.productID + ".jpg";
var fileName:File = new File()
fileName.nativePath = "C:/STSMultimediaSync/market/pictures/{imageName}";
trace(fileName.exists);
....
PS - I know the file exists as when I hard code the image name, the value changes to true.
Upvotes: 2
Views: 5229
Reputation: 13532
I don't think you can do {} inside AS3 (It can be done in mxml). Try :
fileName.nativePath = "C:/STSMultimediaSync/market/pictures/"+imageName;
Upvotes: 3