Import an XML file and use the data.


/ Published in: ActionScript 3
Save to your folder(s)

///////////////////////////////////////////////////////////////////////////////////////////
XML USED IN EXAMPLE:



This is the copy that goes in the description text



Copy this code and paste it in your HTML
  1. var Loader:URLLoader = new URLLoader();
  2. var xmlData:XML = new XML();
  3.  
  4. Loader.load(new URLRequest("xml/start.xml"));
  5. Loader.addEventListener(Event.COMPLETE, LoadXML1);
  6.  
  7. function LoadXML1(e:Event)
  8. {
  9. xmlData = new XML(e.target.data);
  10. };
  11.  
  12. function steveClick(evt:MouseEvent):void // Mouse click to get xml info
  13. {
  14. loadText("Steven Williams");
  15. };
  16.  
  17. function loadText(textLoad)
  18. {
  19. var testimonialList:XMLList = xmlData.question.(@Title == textLoad).description;
  20. TestimonialsMain_mc.txtText.text = testimonialList;
  21. };

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.