revlob
07-24-2009, 06:20 PM
I'm trying to write a gallery application in Flash (AS3). It uses a simple XML document to specify a series of images like this:
<Gallery name="foo">
<Image src="foo/1.jpg" />
<Image src="foo/2.jpg" />
</Gallery>
<Gallery name="bar">
<Image src="bar/1.jpg" />
<Image src="bar/2.jpg" />
</Gallery>
I have a class which parses the XML and displays the images (which sit locally, relative to the .swf file accordiing to the 'src' properties in the XML above) in a UILoader instance. This works great until I move the .swf file somewhere else, as the images aren't part of the compiled file, and obviously it's now looking for them in the wrong place.
I understand that you can use [Embed] to embed assets into your code (this is how I include the XML document), but I can't use it to embed the images. Is there a way I can embed the images in my flash document, and address them using the src values obtained from my XML?
<Gallery name="foo">
<Image src="foo/1.jpg" />
<Image src="foo/2.jpg" />
</Gallery>
<Gallery name="bar">
<Image src="bar/1.jpg" />
<Image src="bar/2.jpg" />
</Gallery>
I have a class which parses the XML and displays the images (which sit locally, relative to the .swf file accordiing to the 'src' properties in the XML above) in a UILoader instance. This works great until I move the .swf file somewhere else, as the images aren't part of the compiled file, and obviously it's now looking for them in the wrong place.
I understand that you can use [Embed] to embed assets into your code (this is how I include the XML document), but I can't use it to embed the images. Is there a way I can embed the images in my flash document, and address them using the src values obtained from my XML?