9 Replies Latest reply on Feb 27, 2009 3:13 AM by dersler

    loading a single image from external xml

      Hi all, I am struck up with an issue in flex 3
      Below is the mxml code:
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml"
      layout="vertical" creationComplete="siteData.send()">
      private var siteContent:XMLList;
      private function showPage(targetPage:String):void{
      //Search for title of target page
      siteContent = siteData.lastResult.page.(@location==targetPage).title;
      //Show result in label

      //Search for body text of target page
      siteContent = siteData.lastResult.page.(@location==targetPage).text;
      //Show result in label

      <mx:HTTPService url="loadxml.xml" id="siteData" resultFormat="e4x"/>
      <mx:Image source="loadxml.xml"/>
      <mx:Label fontSize="24" id="headerText" text="Click a Button"/>
      <mx:Label id="bodyText" text="The choice is yours!"/>
      <mx:Button label="Home Page" />
      <mx:Button label="About Page" click="showPage('about')"/>
      <mx:Button label="Contact Page" click="showPage('contact')"/>


      and below is the xml file for the same
      <?xml version="1.0" encoding="utf-8"?>
      <page location="home" >
      <image src="loadxmlpic.jpg"></image>
      <page location="about">
      <title>About Page</title>
      <text>More about this site.</text>
      <page location="contact">
      <title>Contact Us</title>
      <text>Get in touch!</text>


      I want the loadxml.jpg defined in the first node to get loaded when the button Home page is clicked. Plz let me kn the correct code.