4 Replies Latest reply on Feb 8, 2008 2:26 PM by ntsiii

    Repeaters

    RamiroAlfaro
      I need some Help with a nested Repeater. I keep getting the folowing error :

      Error: Repeater is not executing.
      at mx.core::Repeater/get currentIndex()
      at MethodInfo-1931()
      at Function/ http://adobe.com/AS3/2006/builtin::apply()
      at MethodInfo-2887()
      at Function/ http://adobe.com/AS3/2006/builtin::apply()
      at mx.binding::Watcher/wrapUpdate()
      at mx.binding::ArrayElementWatcher/updateParent()
      at mx.binding::Watcher/updateChildren()
      at mx.binding::PropertyWatcher/updateProperty()
      at Function/ http://adobe.com/AS3/2006/builtin::apply()
      at mx.binding::Watcher/wrapUpdate()
      at mx.binding::PropertyWatcher/eventHandler()
      at flash.events::EventDispatcher/dispatchEventFunction()
      at flash.events::EventDispatcher/dispatchEvent()
      at mx.core::UIComponent/dispatchEvent()
      at AccordionItem/set VPData()
      at AccordionItem/getRedoVisitPathResponse()
      at flash.events::EventDispatcher/dispatchEventFunction()
      at flash.events::EventDispatcher/dispatchEvent()
      at mx.rpc.http.mxml::HTTPService/ http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()
      at mx.rpc::AbstractInvoker/ http://www.adobe.com/2006/flex/mx/internal::resultHandler()
      at mx.rpc::Responder/result()
      at mx.rpc::AsyncRequest/acknowledge()
      at DirectHTTPMessageResponder/completeHandler()
      at flash.events::EventDispatcher/dispatchEventFunction()
      at flash.events::EventDispatcher/dispatchEvent()
      at flash.net::URLLoader/onComplete()

      Does anybody know how to get around/fix the error.
        • 1. Re: Repeaters
          Gregory Lafrance Level 6
          Can you please post some code for a simplified test program?
          • 2. Re: Repeaters
            ntsiii Level 3
            Typically you get this error when you attempt to use currentItem or currentIndex in an event handler, like:
            click="saveIndex(myRepeater.currentIndex)

            You cannot do this because currentItem and currentIndex only exist when the repeater is actually rendering the children. It does NOT exist when you click the control and execute the handler.

            You need to use getRepeaterItem in your event handler instead. Better yet, use a custom component that encapsulates all of that functionality, and repeat that.
            Tracy
            • 3. Re: Repeaters
              RamiroAlfaro Level 1
              My Sample Code is Below:

              The http call httobj is a secondary call with a different XML Response.

              <?xml version="1.0" encoding="utf-8"?>
              <mx:Application
              xmlns:mx=" http://www.adobe.com/2006/mxml"
              initialize="VPHttp.sendVisitPathRequest()"
              creationComplete="Test()"
              width="650" height="500">

              <mx:Script>
              <![CDATA[
              import assest.CanvasesAS.*;
              import mx.controls.Alert;
              import mx.validators.ValidationResult;
              import mx.collections.ArrayCollection;
              import mx.rpc.events.ResultEvent;
              import mx.rpc.http.mxml.HTTPService;

              public var VPHttp:VisitorPathHttp = VisitorPathHttp.getInstance();
              [Bindable] public var VPData:ArrayCollection = new ArrayCollection();
              [Bindable] public var VHData:ArrayCollection = new ArrayCollection();
              public var httobj:HTTPService = new HTTPService();


              public function Redo():void {
              trace("AccordionHttp ========================= [send VisitPath Request]");
              httobj.url = "C:/GVS2/ChartUI/assest/xml/VisitorPathRefresh.xml";
              // httobj.url = " http://wwwdev2.sitemeter.com:8080/ex1/ex1";
              // httobj.url = " http://localhost:8080/GVSII-Stats/Ex1";
              httobj.method = "get";
              httobj.showBusyCursor = true;
              httobj.makeObjectsBindable = true;
              // httobj.request = getVisitPathModel();
              httobj.addEventListener(ResultEvent.RESULT, getRedoVisitPathResponse);
              httobj.clearResult(true);
              httobj.send();
              }

              private function getRedoVisitPathResponse(event:ResultEvent):void {
              trace("AccordionHttp ========================= [get VisitPath Response]");
              trace("Redo VPHttp << " + httobj.lastResult.root.VisitorPath.visitor.length + " >>");

              try {
              VPData = ArrayCollection(httobj.lastResult.root.VisitorPath.visitor);
              myRep.dataProvider=VPData;
              } catch (error:Error) {
              Alert.show("Redo Error message " + error.toString());
              } finally {
              accTest.selectedIndex=0;
              // Alert.show("continue");
              }

              }

              public function Test():void {
              VPData = ArrayCollection(VPHttp.VisitPathData);
              accTest.selectedIndex=0;
              trace("Test VPHttp << " + VPHttp.VisitPathData.length + " >> --- " + "Test VPData << " + VPData.length + " >>");
              }
              ]]>
              </mx:Script>

              <mx:Button label="ReLoad" click="Redo()"/>
              <mx:Button label="Top" click="Test()"/>

              <mx:Accordion id="accTest" resizeToContent="true" fontSize="9" creationPolicy="all">
              <mx:Repeater id="myRep" dataProvider="{VPData}">
              <mx:Form>
              <mx:VBox id="hb1" height="175" verticalGap="0">
              <mx:HBox >
              <mx:Label width="72" fontWeight="bold" text="Date"/>
              </mx:HBox>

              <mx:Repeater id="myRep2" dataProvider="{VPData[myRep.currentIndex].history}">
              <mx:HBox verticalGap="0">
              <mx:Label id="myDateD" width="72" text="{VPData[myRep.currentIndex].history[myRep2.currentIndex].history_date}"/>
              </mx:HBox>
              </mx:Repeater>

              </mx:VBox>
              </mx:Form>
              </mx:Repeater>
              </mx:Accordion>
              </mx:Application>

              • 4. Re: Repeaters
                ntsiii Level 3
                You do not want to do it like that.

                Remember that current item has a reference to the entire item, including the data needed for the inner repeater. So you want to do something like this:
                <mx:Repeater id="myRep2" dataProvider="{myRep.currentItem.history}">
                <mx:HBox verticalGap="0">
                <mx:Label id="myDateD" width="72" text="{myRep2.currentItem.history_date}"/>

                Tracy