【问题标题】:check if a file exists in a folder actionScript 3检查文件夹中是否存在文件 actionScript 3
【发布时间】:2012-07-18 17:18:59
【问题描述】:

我想检查文件是否存在,如果不存在则显示 noimage.gif。以下在控制台中返回 false,您能帮忙吗?

 ...
[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 - 我知道文件存在,因为当我硬编码图像名称时,值变为 true。

【问题讨论】:

    标签: image actionscript-3 apache-flex air directory


    【解决方案1】:

    我认为您不能在 AS3 中执行 {}(可以在 mxml 中完成)。试试看:

    fileName.nativePath = "C:/STSMultimediaSync/market/pictures/"+imageName;
    

    【讨论】:

    • @Baris Usakli - 你是对的。很高兴我现在问。新手的眼睛!
    猜你喜欢
    • 2012-02-05
    • 1970-01-01
    • 1970-01-01
    • 2016-05-20
    • 2011-11-15
    • 2015-11-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多