Flex: Load images and swf's dynamically
I'm building a slide-show like application in Flex and I'm trying to load images dynamically. The images are in a folder outside the application folder. This is the folder structure:
/Bildvisare-debug/ Bildvisare.html Bildvisare.swf /Images/ 01_02_01_01_B.jpg 01_02_01_01_T.JPG
I'm reading the image names from an XML file and get them with a path of ../Images/01_03_01_01_B.jpg
. In my mxml-file 开发者_运维技巧I've got an SWFLoader named picture and I try to load the images with the following code:
this.picture.source = images[currentImg]; //E.g. ../Images/01_03_01_01_B.jpg
this.picture.load();
The problem is that the images never show up, I only get the icon for a missing image. Can anyone help?
Edit to add: I've tried this both with and without the use-network flag set to false when compiling.
I believe this is relevant to your case.
A SWF file can access one type of external resource only, either local or over a network; it cannot access both types. You determine the type of access allowed by the SWF file using the use-network flag when you compile your application. When the use-network flag is set to false, you can access resources in the local file system, but not over the network. The default value is true, which allows you to access resources over the network, but not in the local file system.
From Flex Image Control
精彩评论