0 Replies Latest reply on Sep 24, 2009 6:40 AM by EMelville

    Flex Help - Accordion List - External XML - Duplicate Values

    EMelville

      Hi, I am having what's got to be a really simple problem. You see: http://acompanydesign.com/wcr/11/

       

      The menu headings come out fine, however the links within all duplicate. Can't seem to figure out why. Can you help?

       

      MXML

       

       

      <mx:Script>

      <![CDATA[

       

      import mx.collections.ArrayCollection;

      import mx.utils.ArrayUtil;

      import mx.rpc.events.ResultEvent;

      import flash.events.Event;

      import mx.core.Application;

      public var app:Object = mx.core.Application.application;

       

      //public var myComp1:Menu1 = app.Menu1.newLink;

      //[Bindable]

      //public var navData:ArrayCollection;

       

      [Bindable]public var str:String;

       

      [Bindable] public var httpServiceURL:String;

       

      [Bindable]public var xmlData:Object = new Object();

      [Bindable]public var headingData:Object = new Object();

      [Bindable]public var linkData:Object = new Object();

      [Bindable]public var newLink:String;

       

      private function init():void{

        httpServiceURL  = "properties1.xml?" + Math.round(Math.random() * ( 1+1000 ));

        srv.send();

      }

       

      private function getHeadings(evt:ResultEvent):void{

        xmlData = evt.result;

        headingData = xmlData.a_nav;

        linkData = headingData.heading[1];

      }

       

      private function getLinkObject(a:Number):Object{

      linkData = headingData.heading[a];

      return linkData;

      }

      public function getLinks(a:Number):String{

      str = linkData.link[a].linkname;

      return str;

      }

       

      public function StrapPrint(event:MouseEvent):void

      {

      newLink = event.currentTarget.getRepeaterItem();

      app.VideoWindow.source = newLink;

      app.VideoWindow.play();

      }

       

      //ExteriorUpperPrint(event)

      //navigateToURL(new URLRequest(event.currentTarget.getRepeaterItem()), '_top')

      ]]>

      </mx:Script>

       

       

       

      <mx:HTTPService id="srv" url="{httpServiceURL}" resultFormat="object" result="getHeadings(event);"/>

       

       

      <mx:Accordion id="accordion" width="193" height="380" x="0" y="0">

       

      <mx:Repeater id="rep" dataProvider="{headingData.heading}">

      <mx:VBox label="{rep.currentItem.title}" styleName="headerBox" backgroundColor="#fafafa" width="{rep.currentItem.width}" height="{rep.currentItem.height}">

      <mx:Repeater id="rep2" dataProvider="{getLinkObject(rep.currentIndex).link}">

      <mx:LinkButton click="StrapPrint(event)" label="{getLinks(rep2.currentIndex)}" />

      </mx:Repeater>

      </mx:VBox>

       

      </mx:Repeater>

       

      </mx:Accordion>

       

      XML

       

       

      <a_nav>

          <heading title="Category5" width="230" height="500">

      <link linkname="Video 45">2</link>

      <link linkname="Video 46">3</link>

      <link linkname="Video 47">4</link>

      <link linkname="Video 48">5</link>

      <link linkname="Video 49">6</link>

      <link linkname="Video 50">7</link>

      <link linkname="Video 51">8</link>

      <link linkname="Video 52">9</link>

      <link linkname="Video 53">10</link>

      <link linkname="Video 54">11</link>

      <link linkname="Video 55">1</link>

          </heading>

       

          <heading title="Category 6" width="230" height="500">

      <link linkname="Video 56">http://www.acompanydesign.com</link>

      <link linkname="Video 57">http://www.acompanydesign.com</link>

      <link linkname="Video 58">http://www.acompanydesign.com</link>

      <link linkname="Video 59">http://www.acompanydesign.com</link>

      <link linkname="Video 60">http://www.acompanydesign.com</link>

      <link linkname="Video 61">http://www.acompanydesign.com</link>

      <link linkname="Video 62">http://www.acompanydesign.com</link>

      <link linkname="Video 63">http://www.acompanydesign.com</link>

      <link linkname="Video 64">http://www.acompanydesign.com</link>

      <link linkname="Video 65">http://www.acompanydesign.com</link>

      <link linkname="Video 66">http://www.acompanydesign.com</link>

          </heading>

       

              <heading title="Category 7" width="230" height="500">

      <link linkname="Video 56a">http://www.acompanydesign.com</link>

      <link linkname="Video 57a">http://www.acompanydesign.com</link>

      <link linkname="Video 58a">http://www.acompanydesign.com</link>

      <link linkname="Video 59a">http://www.acompanydesign.com</link>

      <link linkname="Video 60a">http://www.acompanydesign.com</link>

      <link linkname="Video 61a">http://www.acompanydesign.com</link>

      <link linkname="Video 62a">http://www.acompanydesign.com</link>

      <link linkname="Video 63a">http://www.acompanydesign.com</link>

      <link linkname="Video 64a">http://www.acompanydesign.com</link>

      <link linkname="Video 65a">http://www.acompanydesign.com</link>

      <link linkname="Video 66a">http://www.acompanydesign.com</link>

          </heading>

       

      </a_nav>