1 Reply Latest reply on Sep 7, 2010 12:59 PM by jimmyoneshot

    VideoDisplay/Slider Error = Error #1063: Argument count mismatch on... Expected 0, got 1

    jimmyoneshot Level 1

      I'm trying to connect a hslider to a video display. The idea being that as I move the slider the video will update live however when I drag the slider or the playhead updates ie. the video moves forward by a second I get the error in the title of this thread i.e:-

       

      ArgumentError: Error #1063: Argument count mismatch on components::VideoPopUp/onPlayingVideoUpdate(). Expected 0, got 1

       

      Here is the code that I use for my HSlider and myVideo Display. Can anyone please help me out as I'm not sure where I'm going wrong here:-

       

      <mx:Script>
       <![CDATA[
        import mx.events.VideoEvent;
        import mx.events.SliderEvent;
         
        private function videoDisplaySliderThumbDragHandler(event:SliderEvent):void{    
            videoDisplay.playheadTime = videoDisplaySlider.value;   
        }
        private function videoDisplaySlider_ThumbPress():void{
            videoDisplay.removeEventListener(VideoEvent.PLAYHEAD_UPDATE, onPlayingVideoUpdate); 
            videoDisplay.pause();
        }
        private function videoDisplaySlider_ThumbRelease():void{
             videoDisplay.addEventListener(VideoEvent.PLAYHEAD_UPDATE, onPlayingVideoUpdate);
             videoDisplay.playheadTime = videoDisplaySlider.value;
             videoDisplay.play();
        }
         
        private function videoDisplay_ready():void{
             videoDisplay.addEventListener(VideoEvent.PLAYHEAD_UPDATE, onPlayingVideoUpdate);
             videoDisplay.visible = true;
        }
         
        private function onPlayingVideoUpdate() :void{
             videoDisplaySlider.value = videoDisplay.playheadTime;
        }
         
       ]]>
      </mx:Script>
      
      <mx:HSlider id="videoDisplaySlider" invertThumbDirection="true" allowTrackClick="false" liveDragging="true" thumbDrag="videoDisplaySliderThumbDragHandler(event)" thumbPress="videoDisplaySlider_ThumbPress()" thumbRelease="videoDisplaySlider_ThumbRelease()" minimum="0" maximum="{videoDisplay.totalTime}"/>
      <mx:VideoDisplay id="videoDisplay" ready="videoDisplay_ready()" source="assets/myVideo.mp4" playheadUpdate="onPlayingVideoUpdate()"/>
      
        • 1. Re: VideoDisplay/Slider Error = Error #1063: Argument count mismatch on... Expected 0, got 1
          jimmyoneshot Level 1

          Aha I've managed to solve my own problem I missed the event out of the onVideoPlayingUpdate function I've now changed it to:-

           

          private function onPlayingVideoUpdate(event:VideoEvent) :void{

           

          and it works now.

           

          However I now have another problem when I drag the slider's thumb and then release it the video doesn't jump straight to that point as it should and just starts to play really slowly and jumpy.

           

          Also as I drag the thumb the video isn't changing live.

           

          To see what I'm trying to achieve go to YouTube and start dragging the thumb on the slider on their videos, you can see the picture updating live but I can't get that to happen in this case.

           

          Can anybody help me out on getting this to work smoothly?