0

I am trying to load all the .png files from an internal application folder into a list control and I am stuck on exactly how to do it. I have tried httpservice to get the folder and count how many images there are so I can loop through them but I just cant figure that out.

File structure

-src
    -(default package)
        -my application files
    -icons
        -all my .png files

httpService i tried:

<s:HTTPService id="loadAllImages" destination="/icons" result="gotImages(event)" fault="loadAllImagesFault(event)"/>

This always results in directory not found. Am I going about this completely wrong? Anyone have a suggestion?

4

1 回答 1

1

你不能这样做。要将图像存储在 Flash 应用程序(SWF 或 AIR)中,您必须@Embed('')使用MXML 或使用 [Class] 方法将其嵌入。

在 AIR 应用程序中实际显示内部文件夹的文件夹目录的唯一方法是使用 File(这是一个 AIR 专用类)。

var file:File = File.applicationDirectory;
file.browseForDirectory('icons'); ; //unsure if that will pull an internal folder or not, but you get the idea

如果这是一个外部目录(听起来不像),我相信你会按照你在问题中显示的方式去做(虽然我从来不需要使用这种方法,所以我不知道它是否/如何工作)

于 2012-10-27T00:13:28.280 回答