
here is my code and xml
var loaders:Array = []; var imageLoader:Loader; var xml:XML; var xmlList:XMLList; //var hover = xmlList.hover; var xmlLoader:URLLoader = new URLLoader(); xmlLoader.load(new URLRequest(“images5.xml”)); xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded); function xmlLoaded(event:Event):void { xml = XML(event.target.data); xmlList = xml.children(); for(var i:int = 0; i<xmlList.length();i ++){ imageLoader = new Loader(); imageLoader.load(new URLRequest(xmlList[i].@src)); imageLoader.y = 25; imageLoader.x = 25 + (i * 205)/2; imageLoader.scaleX = imageLoader.scaleY =.5 addChild(imageLoader); loaders.push(imageLoader); imageLoader.addEventListener(MouseEvent.MOUSE_OVER, onOver); //imageLoader.addEventListener(MouseEvent.CLICK, onClick); } } function onOver(event:MouseEvent):void{ Sample.text = xmlList.hover[loaders.indexOf(event.target)]; }
<images> <image src=“images/Sunset.jpg”> <hover> <![CDATA[Hovering over <b>Toungue</b> smiley]]> </hover> <click> <![CDATA[<b>Toungue</b> smiley selected]]> </click> </image> <image src=“images/Winter.jpg”> <hover> <![CDATA[Hovering over <b>Toungue</b> smiley]]> </hover> <click> <![CDATA[<b>Toungue</b> smiley selected]]> </click> </image> <image src=“images/Waterlilies.jpg”> <hover> <![CDATA[Hovering over <b>Toungue</b> smiley]]> </hover> <click> <![CDATA[<b>Toungue</b> smiley selected]]> </click></image> <image src=“images/forest.jpg”><hover> <![CDATA[Hovering over <b>Toungue</b> smiley]]> </hover> <click> <![CDATA[<b>Toungue</b> smiley selected]]> </click></image> <image src=“images/Tree.jpg”> <hover> <![CDATA[Hovering over <b>Toungue</b> smiley]]> </hover> <click> <![CDATA[<b>Toungue</b> smiley selected]]> </click> </image> </images>
Please advise on how to load xml into dynamic textfield on my stage.
If you would like to make a comment, please fill out the form below.
did you ever get your problem solved? I have run into the exact same problem, I ‘d really appreciate your advice
I entered the wrong email address in my previous post, I’m new to this. please answer to thispost. did you ever get your problem solved? I have run into the exact same problem, I ‘d really appreciate your advice