Loading xml in dynamic textfield

By Blade27 | Jan 11, 2009

actionscript3

Im struggling to load the text of this image in the textfield I placed on the stage with an instance name of "Sample". If I load it into as3 Textfield
eg var field: Textfield = new TextField; it works, but if I try to load it into a dynamic textfield on the stage it doesn’t work. Why?

here is my code and xml

ActionScript Code:
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)];                 }

ActionScript Code:
<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.

actionscript3

Please reply at our Forum

2 Comments so far
  1. whitejamz March 26, 2009 3:41 pm

    did you ever get your problem solved? I have run into the exact same problem, I ‘d really appreciate your advice

  2. whitejamz March 26, 2009 3:43 pm

    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

Leave a Comment

If you would like to make a comment, please fill out the form below.

Name (required)

Email (required)

Website

Comments

© 2007 ActionScript 3.0