0 Replies Latest reply on May 16, 2007 2:01 PM by xrum

    XML - one to many

    xrum Level 2
      hi, my xml consists of the following:
      category - each category may have 1 title and mutlipe links (link name, and url)
      below is my code.
      the problem is this: when i populate my list, it works just find, but when i click on a value,if there is more than 1 title, the gotoURL gets confused, and gives me an error.... the error makes me think that it tries to go to all 3 urls in that category, instead of just the one selected.

      any ideas on how to fix it?

      Thanks?

      Code:
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" backgroundGradientColors="[#7dacf9, #ffffff]">


      <mx:Script>
      <![CDATA[
      import mx.controls.Label;
      import flash.net.navigateToURL;

      [Bindable]
      private var MyCat:XML =
      <categories>
      <category ID="0">
      <title>Administrative Groups</title>
      <link>
      <linkTitle>Administrative Groups</linkTitle>
      <linkURL> http://www.sadf.com/isadf.pdf</linkURL>
      </link>
      </category>

      <category ID="1">
      <title>AO Forum Minutes</title>
      <link>
      <linkTitle>AO Forums 2007</linkTitle>
      <linkURL> http://www.test.com/forums%202007.pdf</linkURL>
      </link>
      <link>
      <linkTitle>AO Forum Minutes 030507</linkTitle>
      <linkURL> http://www.test.com/asfa f20030507.pdf</linkURL>
      </link>
      <link>
      <linkTitle>AO Forum Minutes 011807</linkTitle>
      <linkURL> http://www.test.com/1807.pdf</linkURL>
      </link>
      </category>
      </categories>
      ]]>
      </mx:Script>


      <mx:Panel width="60%" height="60%" layout="absolute" horizontalCenter="0" verticalCenter="-7.5">
      <mx:HBox width="100%" height="32" horizontalAlign="center" verticalAlign="middle" top="10" horizontalCenter="0">
      <mx:Label text="AO Hotspot Category:" fontWeight="bold"/>
      <mx:ComboBox id="cmbbooks" dataProvider="{MyCat.category.title}" />
      </mx:HBox>
      <mx:List width="60%" height="132" horizontalCenter="0.5" dataProvider="{MyCat.category.(@ID==cmbbooks.selectedIndex).link.linkTitle}" verticalCenter="1"
      click="navigateToURL(new URLRequest(MyCat.category.(@ID==cmbbooks.selectedIndex).link.linkURL ), '_blank')" />

      </mx:Panel>
      <mx:Label text="maintained by ASD" color="#7dacf9" bottom="10" horizontalCenter="0"/>

      </mx:Application>