loading image by xml

Posted by xoom 
loading image by xml
March 09, 2009 11:52AM
hello
it is possible to load image with a xml?
xoom
Re: loading image by xml
March 10, 2009 01:36PM
Yes you can load images from XML
I think this will help you: [www.jumpeyecomponents.com]
It's from TxEff2 but I think it will help
Re: loading image by xml
March 11, 2009 01:20PM
Here is an example on how to load an image from Xml, wait for it to be fully loaded and then do the effect:
First thing you need to do is create a new .fla file, drag the FlashEff Component on the stage and I've used Flash Loader [www.jumpeyecomponents.com] but the default one will do just fine.
Name the FlashEff component "fe" and the loader "ldr". Drag the FlashEff component over the Loader, it will automaticly snap to place.
Here is what you should add in the action script panel:

import com.jumpeye.Events.FLASHEFFEvents;
import com.jumpeye.Events.LoaderEvents;
var myXML:XML = new XML();
var XML_URL:String = "example.xml";
var myXMLURL:URLRequest = new URLRequest(XML_URL);
var myLoader:URLLoader = new URLLoader(myXMLURL);
var pic:String
myLoader.addEventListener("complete", xmlLoaded);
function xmlLoaded(event:Event):void
{
myXML = XML(myLoader.data);
pic = myXML.img[0]//now it will load the first picture. Change this value to load whatever you want.
ldr.visible=false
ldr.source=pic
}
ldr.addEventListener(LoaderEvents.LOAD,loadHandler);
function loadHandler(evt:LoaderEvents):void {
ldr.visible=true
fe.show()
}

Now you will need to create the XML file, paste the following text in an empty notepad document:

<?xml version=1.0 encoding=UTF-8 ?>
<img_list>
<img>1.jpg</img>
<img>2.jpg</img>
</img_list>

Save it and name it "eample.xml".
And you will need to have at least one picture in the same folder where the fla is named: "1.jpg"
Compile and see the results.



Edited 1 time(s). Last edit at 03/11/2009 01:21PM by Ionut.
Re: loading image by xml
March 13, 2009 09:02AM
thank u very much lonut
i try this today, it s very to put a little tutorial
thx again xoom
Sorry, only registered users may post in this forum.

Click here to login