I’m trying to get my xml images into movie clips on my stage.
Here is the AS im using to get them to come up onto the stage scrolling, but i want them to gointo movie clips i’ve created to for them.
I’ve serched the internet for ages, and i’ve tryed to use this forum search and all i get is a blank screen.
AS Code:
var xml:XML = new XML();
var img_count:uint;
var loader:URLLoader = new URLLoader();
var img_holder:Sprite=new Sprite();
var sw:Number=stage.stageWidth;
addChild(img_holder);
function xmlloaded(e:Event):void {
xml=XML(e.target.data);
img_count = xml.img.length()-1;
for (var i:uint = 0; i<img_count; i++) {
var thumb:Sprite=new createThumb(img_holder,String(xml.img*.@thumburl),String(xml.img*.@mainurl));
thumb.x=105*i;
img_holder.addChild(thumb);
}
stage.addEventListener(Event.ENTER_FRAME,mousescroll);
}
function mousescroll(e:Event):void {
var ihw:Number = (img_holder.width-sw+100)*-1;
var percent:Number = 50+(mouseX/sw)*(ihw);
img_holder.x=percent;
}
loader.load(new URLRequest('gall.xml'));
loader.addEventListener(Event.COMPLETE,xmlloaded);
My xml file is:
<?xml version="1.0" encoding="utf-8"?>
<photographs>
<img mainurl="assets/sxc_hu_410471_5588.jpg" />
<img mainurl="assets/sxc_hu_1151936_79441078.jpg" />
<img mainurl="assets/sxc_hu_1154131_54136948.jpg" />
</photographs>
I’m new to flash / AS so all the help i can get is much appreciated.
Thanks for reading. :beer2: