2 Replies Latest reply on Oct 22, 2009 12:20 PM by braddini

    videoDisplay and events question and looping the video?

    braddini

      i have a flex ap that starts a video via a button click, i also have an event handle to detect when the video is finished

      code sample below

       

      private function loadandstartvideo(event:Event):void

           {

                var thisvideo:VideoDisplay = VideoDisplay.getChildbyName("thisvid")

                thisvideo.removeevent(event.Complete,videoDisplay)

                thisvideo.source = "path/to/vid/"

                thisvideo.addeventListen(event.complete,restartvid)

                thisvideo.play();

           }

       

      private function restartvid(event:Event):void

           {

                var thisvideo:VideoDisplay = VideoDisplay.getChildbyName("thisvid")

                thisvideo.play()

       

           }

       

      the above code is not the exact code the problem i have is that the loadandstart switched the video just fine but the restartvid function never gets called?

       

      anyone have a clue? if you need the exact code i can post it.

       

       

       

       

       

       

       

       

       

       

           }

        • 1. Re: videoDisplay and events question and looping the video?
          braddini Level 1

          here is the actual code. i poisted the other post from a different computer...

           

          playinto is the function called from the button click

           

           

          private function playintro(boardID:Number):void
              {
                  introIndex = boardID;
                  var boxid:Number = boardID - 1;
                  var vidBoxName:String = "hwsVid" + String(boardID);
                  var vidBox:VideoDisplay = VideoDisplay(HWSDisplay.getChildByName(vidBoxName));
                  vidBox.source = "path to vid;
                  tempWidth = vidBox.width;
                  tempHeight = vidBox.height;
                  tempX = vidBox.x;
                  tempY = vidBox.y;
                  vidBox.x = 0;
                  vidBox.y = 0;
                  vidBox.height = Number(disHeight.text)
                  vidBox.width = Number(disWidth.text)
                  vidBox.maintainAspectRatio = false;
                 
                  var tempVidBox:VideoDisplay = new VideoDisplay;
                  var tempBoxName:String = "";
                  var a:Number;
                  for (a=1;a<10;a++)
                      {
                          if (a != boardID)
                              {
                                  tempBoxName = "hwsVid" + String(a);
                                  tempVidBox = VideoDisplay(HWSDisplay.getChildByName(tempBoxName));
                                  tempVidBox.visible = false;
                              }
                      }
                  vidBox.addEventListener(Event.COMPLETE,onIntroComplete)
                  vidBox.play()
                                 
              }
             
          private function onIntroComplete(event:Event):void
              {
                  var vidBox2:VideoDisplay = VideoDisplay(event.currentTarget);
                  vidBox2.removeEventListener(VideoEvent.COMPLETE,onIntroComplete)
                  vidBox2.source = "path to loop vid;
                  vidBox2.x = tempX;
                  vidBox2.y = tempY;
                  vidBox2.height = tempHeight;
                  vidBox2.width = tempWidth;
                  vidBox2.addEventListener(VideoEvent.COMPLETE,restartVidLoop)
               }

           


          private function restartVidLoop(event:VideoEvent):void
              {
                  var vidBox:VideoDisplay = VideoDisplay(event.currentTarget);
                  vidBox.removeEventListener(Event.COMPLETE,restartVidLoop);
                  vidBox.addEventListener(Event.COMPLETE,restartVidLoop);
                  vidBox.play();
              }

          • 2. Re: videoDisplay and events question and looping the video?
            braddini Level 1

            oh my God i spent two days on this and the whole time it was not a programming issue but an ecoding issue. the flv was not encoded properly. so if your having this issue check the flv encoding settings on your encoder