I am creating an android application in flash builder 4 using 4.1 SDK on windows. The application first downloads some images from the internet and saves them in the desktopDirectory. Now I want to display downloaded images in my flex mobile application.
Issue:
Images are being downloaded from the internet successfully and saved in the desktopDirectory successfully.
Now when I try to display an image using nativePath then it is not displayed. A small blue icon with a questionmark is displayed instead of the image. The code that I am using is as below:
displayContainer.removeAllElements();
var image:spark.components.Image = new spark.components.Image();
var imageFile:File = File.desktopDirectory.resolvePath(desktopFilePath);
if(imageFile.exists)
{
var imagePath:String = File.desktopDirectory.resolvePath(desktopFilePath).nativePath;
image.source = imagePath;
trace("Image Path: " + imagePath);
displayContainer.addElementAt(image,1);
}
When I trace if the image file exists or not, it shows that the file is there. But the file is not displayed in the app.
However, the image is displayed when I hardcode the image path in the code as below:
<s:Image id="a1" source="data/02.jpg" />
Thus the image is there but the path is not being resolved programmatically.
What am I doing wrong? Please guide.
I am testing my application on an android tablet.