Try this:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="absolute">
 <mx:Script>
  <![CDATA[
   import mx.events.SliderEvent;

   [Bindable]
   private var flvPath:String = "flv/suzanne_vega_luka.flv";
   private var wasPlaying:Boolean = false;
   //----------------------------------------------------------
   // hsliderPressHandler()
   //----------------------------------------------------------
   private function hsliderPressHandler(evt:SliderEvent):void {
    trace("Application ::: hsliderPressHandler");
    this.wasPlaying = this.video_vd.playing;
    if(wasPlaying) {
     this.video_vd.pause();
    }
   }
   //-----------------------------------------------------------
   // hsliderReleaseHandler()
   //-----------------------------------------------------------
   private function hsliderReleaseHandler(evt:SliderEvent):void {
    trace("Application ::: hsliderReleaseHandler");
    if(this.wasPlaying) {
     this.callLater(this.video_vd.play);
    }
   }
   //-----------------------------------------------------------
   // hsliderChangeHandler()
   //-----------------------------------------------------------
   private function hsliderChangeHandler(evt:SliderEvent):void {
    trace("Application ::: hsliderChangeHandler");
    trace("    - slider value: "+(this.position_fmt.format(evt.value)));
    this.video_vd.playheadTime = Number(this.position_fmt.format(evt.value));
   }

  ]]>
 </mx:Script>

 <mx:NumberFormatter id="position_fmt" precision="3" />

 <!-- VIDEO PANEL -->
 <mx:Panel id="video_panel" title="Video">

  <mx:VideoDisplay id="video_vd"
   width="320"
   height="240"
   autoPlay="true"
   source="{flvPath}"
   playheadUpdateInterval="100"
    />

  <!-- VIDEO CONTROLS -->
  <mx:ControlBar>
   <mx:HSlider id="video_slider"
    width="100%"
    minimum="0"
    maximum="{this.video_vd.totalTime}"
    liveDragging="false"
    value="{this.video_vd.playheadTime}"
    thumbPress="hsliderPressHandler(event);"
    thumbRelease="hsliderReleaseHandler(event);"
    change="hsliderChangeHandler(event);"
    />
  </mx:ControlBar>

 </mx:Panel>

</mx:Application>


You don't really need the NumberFormatter, but I needed it for an app I'm 
working on, so I left it in.

regards,
Muzak

----- Original Message ----- 
From: "Firdosh Tangri" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Monday, February 12, 2007 2:23 AM
Subject: [flexcomponents] Controlling Video playback using the VideoDisplay 
control


> Is there a tutorial or some help pages on how to control the playback for
> video loaded into a VideoDisplay control using a HSlider ??
>
> thanks
> cheers :)
> firdosh
> 


Reply via email to