0 Replies Latest reply on Jul 23, 2010 9:33 AM by JennHysuick

    Odd Accordion Behaviour

    JennHysuick Level 1

      I have a dynamically populated accordion in my application, and I'm experiencing some very unusual behavior.

       

      Background: I have a User object, and this object contains an array of lecture object.  For each lecture, I add a box to my accordion, and the box contains information about the lecture, along with a Play and Stop button.

       

      The problem is when I select any item other than the first one.  I select the item, and the accordion expands properly.  When I press the PLAY button, the recorded lecture plays (in an iFrame), but then the accordion moves to have the first one (selectedIndex = 0) selected!  It does this every time, and I cannot find out what the problem is.

       

      Does anyone have any ideas what could be causing this?  I have included the main parts of code below.

       

      Thanks in advance.

       

      Jenn

       

      My accordion:

      <mx:Accordion id="accLectList" height="100%" width="100%" change="setCurrLect()" ></mx:Accordion>

       

      Populating:

      for (var c:Number=0; c<event.result.length; c++)
          {
              positionCounter = 0;
              var currLecture:LectureRecordings = new LectureRecordings;
              currLecture.initialize(theRSSFeed, event.result[c].Duration, startDate, event.result[c].Location, event.result[c].InstructorDisplayName,
                      event.result[c].lectureTitle, event.result[c].captureID, event.result[c].lectureDisplayTitle, event.result[c].sequenceID,
                      event.result[c].Instructor, event.result[c].description, event.result[c].lectureID, event.result[c].available);
              theUser.userCourse.getLectureList.push(currLecture);
              var vbInfoBox:VBox = new VBox();
              vbInfoBox.label = currLecture.getRecordingTitle;
              vbInfoBox.styleName = "lightGreyBg";
              vbInfoBox.percentWidth = 100;
              vbInfoBox.percentHeight = 100;
              vbInfoBox.name = currLecture.getLectureListID.toString()
              vbInfoBox.id = "lectBox"+lectureCounter.toString();
              accLectList.addChild(vbInfoBox);
              var hBtnBox:HBox = new HBox();
              var recLink:Button = new Button();
              recLink.name = currLecture.getLectureListID.toString();
              recLink.label = "Play";
              //recLink.data = lectureCounter.toString();
              recLink.data = currLecture.getLectureListID.toString();
              recLink.id = currLecture.getLectureURL;
              recLink.addEventListener(MouseEvent.CLICK,startRecording);
              //Stop Button
              var recStop:Button = new Button();
              recStop.name = currLecture.getLectureListID.toString();
              recStop.id = "";
              recStop.label = "Stop";
              recStop.addEventListener(MouseEvent.CLICK,stopRecording);
              hBtnBox.addChild(recLink);
              hBtnBox.addChild(recStop);
              vbInfoBox.addChild(hBtnBox);
          }

      Play function:

      public function startRecording(event:MouseEvent):void
      {

       

          var recBtn:Button = event.currentTarget as Button;
            var link:String = recBtn.id.toString();
        
          intIFrame.source = link;
          intIFrame.visible = true;

       

      }