Scrub Bar Problems

My scrub bar isn't so percise. When I scrub, the duration is off track. What am I doing wrong? Please help.
PS, it's stream NOT progressive.
// ############# CONSTANTS
// time to buffer for the video in sec.
const BUFFER_TIME:Number                = 8;
// start volume when initializing player
const DEFAULT_VOLUME:Number                = 0.6;
// update delay in milliseconds.
const DISPLAY_TIMER_UPDATE_DELAY:int    = 10;
// smoothing for video. may slow down old computers
const SMOOTHING:Boolean                    = true;
// ############# VARIABLES
// flag for knowing if flv has been loaded
var bolLoaded:Boolean                    = false;
// flag for volume scrubbing
var bolVolumeScrub:Boolean                = false;
// flag for progress scrubbing
var bolProgressScrub:Boolean            = false;
// holds the last used volume, but never 0
var intLastVolume:Number                = DEFAULT_VOLUME;
// net connection object for net stream
var ncConnection:NetConnection;
// net stream object
var nsStream:NetStream;
// object holds all meta data
var objInfo:Object;
var dur:Number;
var totalBytes:Number;
//rtmp of server hosting the flv
var FLVServer:String                    = "rtmp://www.chameleon.com/vids";
//flv file
// Create a new NetConnection instance
var conn:NetConnection = new NetConnection();
// Connect with a null value for progressive FLV files
conn.connect(null);
var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters;
var strSource:String                    = "6.flv";
// timer for updating player (progress, volume...)
var tmrDisplay:Timer;
// ############# FUNCTIONS
// sets up the player
function initVideoPlayer():void {
    // hide buttons
    controlPanel.mcVideoControls.btnUnmute.visible    = false;
    controlPanel.mcVideoControls.btnPause.visible    = false;
    controlPanel.mcVideoControls.normalS.visible    = false;
    // set the progress/preload fill width to 1
    controlPanel.mcVideoControls.mcProgressFill.mcFillRed.width = 1;
    controlPanel.mcVideoControls.mcProgressFill.mcFillGrey.width = 1;
    // add global event listener when mouse is released
    stage.addEventListener( MouseEvent.MOUSE_UP, mouseReleased);
    stage.addEventListener(FullScreenEvent.FULL_SCREEN, onFullscreen);
// ###### PB HIDEN TIMER
    stage.addEventListener(MouseEvent.MOUSE_MOVE, cPanel);
    function cPanel(event:MouseEvent):void {
        controlPanel.gotoAndPlay(1);
        controlPanel.mcVideoControls.mcProgressScrubber.btnProgressScrubber.visible = true;
        Mouse.show();
    // add event listeners to all buttons
    controlPanel.mcVideoControls.btnPause.addEventListener(MouseEvent.CLICK, pauseClicked);
    controlPanel.mcVideoControls.btnPlay.addEventListener(MouseEvent.CLICK, playClicked);
    controlPanel.mcVideoControls.btnStop.addEventListener(MouseEvent.CLICK, stopClicked);
    controlPanel.mcVideoControls.btnMute.addEventListener(MouseEvent.CLICK, muteClicked);
    controlPanel.mcVideoControls.btnUnmute.addEventListener(MouseEvent.CLICK, unmuteClicked);
    controlPanel.mcVideoControls.btnProgressBar.addEventListener(MouseEvent.MOUSE_DOWN, progressScrubberClicked);
    controlPanel.mcVideoControls.btnVolumeBar.addEventListener(MouseEvent.MOUSE_DOWN, volumeScrubberClicked);
    controlPanel.mcVideoControls.mcProgressScrubber.btnProgressScrubber.addEventListener(MouseEvent.MOUSE_DOWN, progressScrubberClicked);
    big_play.addEventListener(MouseEvent.CLICK, BIGPLAY);
    controlPanel.mcVideoControls.fullS.addEventListener(MouseEvent.CLICK, FullScreen);
    controlPanel.mcVideoControls.normalS.addEventListener(MouseEvent.CLICK, NormalScreen);
    // create timer for updating all visual parts of player and add
    // event listener
    tmrDisplay = new Timer(DISPLAY_TIMER_UPDATE_DELAY);
    tmrDisplay.addEventListener(TimerEvent.TIMER, updateDisplay);
    // create a new net connection, add event listener and connect
    // to null because we don't have a media server
    ncConnection = new NetConnection();
    ncConnection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
    ncConnection.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
    ncConnection.connect(FLVServer);
    // set the smoothing value from the constant
    vidDisplay.smoothing = SMOOTHING;
    controlPanel.mcVideoControls.mcProgressScrubber.durationBubble.visible        =    false;
    // set default volume
    controlPanel.mcVideoControls.mcVolumeScrubber.x = (52 * DEFAULT_VOLUME) + 341;
    controlPanel.mcVideoControls.mcVolumeFill.mcFillRed.width = controlPanel.mcVideoControls.mcVolumeScrubber.x - 394 + 52;
function onFullscreen(e:FullScreenEvent):void {
    // check if we're entering or leaving fullscreen mode
    if (e.fullScreen) {
        // switch fullscreen buttons
        controlPanel.mcVideoControls.fullS.visible = false;
        controlPanel.mcVideoControls.normalS.visible = true;
        // bottom center align controls
        controlPanel.x = (Capabilities.screenResolutionX - 440) / 2;
        controlPanel.y = (Capabilities.screenResolutionY - 33);
        // size up video display
        vidDisplay.height     = (Capabilities.screenResolutionY - 33);
        vidDisplay.width     = vidDisplay.height * 4 / 3;
        vidDisplay.x        = (Capabilities.screenResolutionX - vidDisplay.width) / 2;
    } else {
        // switch fullscreen buttons
        controlPanel.mcVideoControls.fullS.visible = true;
        controlPanel.mcVideoControls.normalS.visible = false;
        // reset controls position
        controlPanel.x = 0;
        controlPanel.y = 330;
        // reset video display
        vidDisplay.y = 0;
        vidDisplay.x = 0;
        vidDisplay.width = 440;
        vidDisplay.height = 330;
function FullScreen(e:MouseEvent):void {
    stage.displayState    = "fullScreen";
    controlPanel.mcVideoControls.normalS.visible    = true;
function NormalScreen(e:MouseEvent):void {
    stage.displayState    = "normal";
    controlPanel.mcVideoControls.fullS.visible    = false;
function BIGPLAY(e:MouseEvent):void {
    if( bolLoaded) {
        nsStream.resume();
    // show video display
    vidDisplay.visible                    = true;
    // switch play/pause visibility
    controlPanel.mcVideoControls.btnPause.visible    = true;
    controlPanel.mcVideoControls.btnPlay.visible        = false;
    big_play.visible    =    false;
function playClicked(e:MouseEvent):void {
    // check's, if the flv has already begun
    // to download. if so, resume playback, else
    // load the file
    if( bolLoaded) {
        nsStream.resume();
    // show video display
    vidDisplay.visible                    = true;
    // switch play/pause visibility
    controlPanel.mcVideoControls.btnPause.visible    = true;
    controlPanel.mcVideoControls.btnPlay.visible        = false;
    big_play.visible    =    false;
function pauseClicked(e:MouseEvent):void {
    // pause video
    nsStream.pause();
    // switch play/pause visibility
    controlPanel.mcVideoControls.btnPause.visible    = false;
    controlPanel.mcVideoControls.btnPlay.visible        = true;
    big_play.visible    =    true;
function stopClicked(e:MouseEvent):void {
    // calls stop function
    stopVideoPlayer();
    big_play.visible    =    true;
function muteClicked(e:MouseEvent):void {
    // set volume to 0
    setVolume(0);
    // update scrubber and fill position/width
    controlPanel.mcVideoControls.mcVolumeScrubber.x                = 341;
    controlPanel.mcVideoControls.mcVolumeFill.mcFillRed.width    = 1;
function unmuteClicked(e:MouseEvent):void {
    // set volume to last used value
    setVolume(intLastVolume);
    // update scrubber and fill position/width
    controlPanel.mcVideoControls.mcVolumeScrubber.x = (53 * intLastVolume) + 341;
    controlPanel.mcVideoControls.mcVolumeFill.mcFillRed.width = controlPanel.mcVideoControls.mcVolumeScrubber.x - 394 + 53;
function volumeScrubberClicked(e:MouseEvent):void {
    // set volume scrub flag to true
    bolVolumeScrub = true;
    // start drag
    controlPanel.mcVideoControls.mcVolumeScrubber.startDrag(true, new Rectangle(341, 19, 53, 0));
function progressScrubberClicked(e:MouseEvent):void {
    // set progress scrub flag to true
    bolProgressScrub = true;
    controlPanel.mcVideoControls.mcProgressScrubber.durationBubble.visible        =    true;
    // start drag
    controlPanel.mcVideoControls.mcProgressScrubber.startDrag(true, new Rectangle(0, -6, 630, 0));
function mouseReleased(e:MouseEvent):void {
    // set progress/volume scrub to false
    bolVolumeScrub        = false;
    bolProgressScrub    = false;
    controlPanel.mcVideoControls.mcProgressScrubber.durationBubble.visible        =    false;
    // stop all dragging actions
    controlPanel.mcVideoControls.mcProgressScrubber.stopDrag();
    controlPanel.mcVideoControls.mcVolumeScrubber.stopDrag();
    // update progress/volume fill
    controlPanel.mcVideoControls.mcProgressFill.mcFillRed.width    = controlPanel.mcVideoControls.mcProgressScrubber.x + 5;
    controlPanel.mcVideoControls.mcVolumeFill.mcFillRed.width    = controlPanel.mcVideoControls.mcVolumeScrubber.x - 394 + 53;
    // save the volume if it's greater than zero
    if((controlPanel.mcVideoControls.mcVolumeScrubber.x - 341) / 53 > 0)
        intLastVolume = (controlPanel.mcVideoControls.mcVolumeScrubber.x - 341) / 53;
var duration:Number;
function updateDisplay(ev:TimerEvent):void {
    // checks, if user is scrubbing. if so, seek in the video
    // if not, just update the position of the scrubber according
    // to the current time
    if(bolProgressScrub)
        nsStream.seek( Math.round( controlPanel.mcVideoControls.mcProgressScrubber.x * objInfo.duration / 630 ) )
    else
    controlPanel.mcVideoControls.mcProgressScrubber.x = nsStream.time * 630 / objInfo.duration;
    // set time and duration label
    controlPanel.mcVideoControls.lblTimeDuration.htmlText        = "<font color='#FFFFFF'>" + formatTime(nsStream.time) + "</font> / " + formatTime(objInfo.duration);
    controlPanel.mcVideoControls.mcProgressScrubber.durationBubble.lblTimeDuration.htmlText        = "<font color='#FFFFFF'>" + formatTime(nsStream.time) + "</font>";
    // update the width from the progress bar. the grey one displays
    // the loading progress
    controlPanel.mcVideoControls.mcProgressFill.mcFillRed.width        =     controlPanel.mcVideoControls.mcProgressScrubber.x + 5;
    controlPanel.mcVideoControls.mcProgressFill.mcFillGrey.width    =    nsStream.bytesLoaded * 630 / nsStream.bytesTotal;
    // update volume and the red fill width when user is scrubbing
    if(bolVolumeScrub) {
        setVolume((controlPanel.mcVideoControls.mcVolumeScrubber.x - 341) / 53);
        controlPanel.mcVideoControls.mcVolumeFill.mcFillRed.width = controlPanel.mcVideoControls.mcVolumeScrubber.x - 394 + 53;
function onMetaData(info:Object):void {
objInfo = info;
// now we can start the timer because
// we have all the necessary data
if(!tmrDisplay.running)
tmrDisplay.start();
function netStatusHandler(event:NetStatusEvent):void {
    // handles net status events
    trace( event.info.code );
    switch (event.info.code) {
        case "NetConnection.Connect.Success":
           connectStream();
            break;
        // trace a messeage when the stream is not found
        case "NetStream.Play.StreamNotFound":
            trace("Stream not found: " + strSource);
            break;
        // when the video reaches its end, we stop the player
        case "NetStream.Play.Stop":
            stopVideoPlayer();
            trace('stoped');
        break;
function securityErrorHandler(event:SecurityErrorEvent):void {
    trace("securityErrorHandler: " + event);
function connectStream():void {
    nsStream = new NetStream(ncConnection);
    nsStream.bufferTime = BUFFER_TIME;
    // nsStream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
    nsStream.client =  this;
    bolLoaded = true;
    vidDisplay.attachNetStream(nsStream);       
    nsStream.seek(5);
    nsStream.play(strSource);
    nsStream.pause();
    // attach net stream to video object on the stage
    vidDisplay.attachNetStream(nsStream);
    vidDisplay.visible = true;
function stopVideoPlayer():void {
    // pause netstream, set time position to zero
    nsStream.pause();
    nsStream.seek(0);
    // in order to clear the display, we need to
    // set the visibility to false since the clear
    // function has a bug
    vidDisplay.visible                    = false;
    // switch play/pause button visibility
    controlPanel.mcVideoControls.btnPause.visible    = false;
    controlPanel.mcVideoControls.btnPlay.visible        = true;
function setVolume(intVolume:Number = 0):void {
    // create soundtransform object with the volume from
    // the parameter
    var sndTransform        = new SoundTransform(intVolume);
    // assign object to netstream sound transform object
    nsStream.soundTransform    = sndTransform;
    // hides/shows mute and unmute button according to the
    // volume
    if(intVolume > 0) {
        controlPanel.mcVideoControls.btnMute.visible        = true;
        controlPanel.mcVideoControls.btnUnmute.visible    = false;
    } else {
        controlPanel.mcVideoControls.btnMute.visible        = false;
        controlPanel.mcVideoControls.btnUnmute.visible    = true;
function formatTime(t:int):String {
    var remainder:Number;
    var hours:Number = t / ( 60 * 60 );
    remainder = hours - (Math.floor ( hours ));
    hours = Math.floor ( hours );
    var minutes = remainder * 60;
    remainder = minutes - (Math.floor ( minutes ));
    minutes = Math.floor ( minutes );
    var seconds = remainder * 60;
    remainder = seconds - (Math.floor ( seconds ));
    seconds = Math.floor ( seconds );
    var hString:String = hours < 10 ? "0" + hours : "" + hours;   
    var mString:String = minutes < 10 ? "0" + minutes : "" + minutes;
    var sString:String = seconds < 10 ? "0" + seconds : "" + seconds;
    if ( t < 0 || isNaN(t)) return "00:00";           
    if ( hours > 0 )
        return hString + ":" + mString + ":" + sString;
    }else
        return mString + ":" + sString;
// ############# INIT PLAYER
initVideoPlayer();

errr you won't be able to do anything with that......here you go. Don't say I never gave you anything.
package NetConnections.NetStreams{
import flash.net.*;
import flash.events.*;
import flash.display.Sprite;
import flash.display.DisplayObject;
import flash.display.MovieClip;
import flash.media.*;
import flash.net.*;
import NetConnections.NetConnections;
//import UI.BeginAudio;
//import UI.RecordAudio;
//import Main.SendObject;
import fl.controls.ProgressBar;
import fl.controls.ProgressBarDirection;
import fl.controls.ProgressBarMode;
//import fl.controls.NumericStepper;
//import fl.controls.Label;
import flash.utils.Timer;
public class Audio extends Sprite {
  //var audioS0:NetStream;
  var audioR0:NetStream;
  //var btns1:Object;
  //var mic0:Microphone;
  var rePublishID1:Number;
  //var speaker:int=0;
  var userName00:*;
  var main00:Object;
  public var video0:Video;
  public var progBar:ProgBar;
  //var stepper:NumericStepper;
  //var progLabel:Label;
  //var divID=1;
  var percent;
  var customClient0:Object;
  //var customClient2:Object;
  var duration:Number;
  var step:Number;
  //public var uvCon:Sprite;
  //public var auTrack:Sprite;
  //var micAct:Number;
  //var scale0:Number;
  var oneTime0:int=0;
  var oneTime1:int=0;
  var audioTime0:int=0;
  var yMin:Number;
  var yMax:Number;
  var yOffset:Number;
  var yMin1:Number;
  var yMax1:Number;
  var yOffset1:Number;
  var step1:Number=0;
     var step2:Number=0;
  var amountLoaded:Number;
  var stepper0:Number=0;
  var thisButton:String;
  var stopScrub:int=0;
  var vol:Number =0.75;
  var flashID=0;
  var tim0:Timer;
  //var ID3Meta00:Object;
  //var sFX:SoundChannel;
  //var soundFactory:Sound;
  //var request:URLRequest;
  //var mp3ID:int=0;
  //var T:int=0;
  //var mp3Tim:Timer;
  //var inc:Number;
  //var inc1;
  //var inc2;
  //var inc3;
  public function Audio(audioR:NetStream,userName0:*,main0:Object):void {
   main00=main0;
   //ID3Meta00 = ID3Meta;
   //mic0=Microphone.getMicrophone();
   //mic0.gain =50;
   //mic0.rate=11;
   //audioS0=audioS;
   audioR0=audioR;
   userName00 = userName0;
   main00=main0;
   video0 = new Video(320,240);
   progBar = new ProgBar();
   progBar.progBar.direction = ProgressBarDirection.RIGHT;
   progBar.progBar.mode = ProgressBarMode.POLLED;
   yMin = 0;
   yMax = main00.progBar.progBar.width - main00.progBar.scrubber.width;
   yMin1 = 0;
   yMax1 = main00.track0.width - main00.track0.volThumb.width;
   main00.progBar.progBar.addEventListener(Event.COMPLETE, CompleteHandler,false,0,true);
   main00.play_btn.buttonMode=true;
   main00.play_btn.addEventListener(MouseEvent.MOUSE_DOWN,PlayBack);
   main00.pause_btn.buttonMode=true;
   main00.pause_btn.addEventListener(MouseEvent.MOUSE_DOWN,PausePlayBack);
   audioR0.addEventListener(NetStatusEvent.NET_STATUS,DetectEnd,false,0,true);
   tim0 = new Timer(1000,0);
   tim0.addEventListener(TimerEvent.TIMER,countBuff,false,0,true);
   PlayBack();
  private function PlayBack(e:MouseEvent=null):void{
   main00.pause_btn.x=main00.play_btn.x;
   main00.pause_btn.y=main00.play_btn.y;
   main00.play_btn.x =main00.pause_btn.x;
   main00.play_btn.y =2800;
   if(audioTime0==0){
   SetAudio(0);
   audioTime0=1;
   }else{
   SetAudio(1);
  private function PausePlayBack(e:MouseEvent=null):void{
   main00.play_btn.x =main00.pause_btn.x;
   main00.play_btn.y =main00.pause_btn.y;
   main00.pause_btn.x=main00.play_btn.x;
   main00.pause_btn.y=2800;
   SetAudio(1);
  private function thumbDown(e:MouseEvent):void {
   thisButton ="scrubber";
   stopScrub=1;
      ChangeHandler();
   main00.stage.addEventListener(MouseEvent.MOUSE_MOVE, thumbMove);
   yOffset = mouseX - main00.progBar.scrubber.x;
  private function thumbUp(e:MouseEvent):void {
   stopScrub=0;
   ChangeHandler();
   step1=0;
   step2=0;
   main00.stage.removeEventListener(MouseEvent.MOUSE_MOVE, thumbMove);
  private function thumbMove(e:MouseEvent):void {
   main00.progBar.scrubber.x = mouseX - yOffset;
   if (main00.progBar.scrubber.x <= yMin) {
    main00.progBar.scrubber.x = yMin;
   if (main00.progBar.scrubber.x >= yMax) {
    main00.progBar.scrubber.x = yMax;
   dispatchEvent(new ScrollBarEvent(main00.progBar.scrubber.x / yMax));
   e.updateAfterEvent();
  private function sbChange(e:ScrollBarEvent):void {
   trace(e.currentTarget.name);
   //var vol = Math.floor(e.scrollPercent*100)*.01;
   if(thisButton=="scrubber"){
   //audioR0.seek(step2);
   step1 = Math.floor((main00.progBar.scrubber.x/main00.progBar.progBar.width)*duration);
   audioR0.seek(step1);
   trace(step1);
   //main00.progBar.progBar.setProgress(step1,duration);
   if(thisButton=="volThumb"){
    vol=Math.floor(e.scrollPercent*100)*.02;
    trace("+++++++"+main00.track0.volThumb.x);
    trace(vol);
   if (audioR0 != null) {
   var st:SoundTransform = new SoundTransform(vol);
   audioR0.soundTransform = st;
  //rewind
  private function Rewind(e:MouseEvent):void{
   audioR0.seek(0);
   stepper0=0;
  private function FastFD(e:MouseEvent):void{
  trace("ok");
  var stepper1:Number=Math.floor((main00.progBar.scrubber.x/main00.progBar.progBar.width)*durat ion);
  stepper1++;
  stepper1=stepper1*2;
  if(stepper1>=duration){
   stepper1=duration-2;
  if(main00.progBar.progBar.percentComplete ==100){
   stepper1=duration-2;
   progBar.progBar.reset();
   audioR0.seek(stepper1);
//volume
private function thumbDown1(e:MouseEvent):void {
         thisButton="volThumb";
   main00.stage.addEventListener(MouseEvent.MOUSE_MOVE, thumbMove1);
   yOffset1 = mouseX - main00.track0.volThumb.x;
  private function thumbUp1(e:MouseEvent):void {
   main00.stage.removeEventListener(MouseEvent.MOUSE_MOVE, thumbMove1);
  private function thumbMove1(e:MouseEvent):void {
   main00.track0.volThumb.x = mouseX - yOffset1;
   if (main00.track0.volThumb.x <= yMin1) {
    main00.track0.volThumb.x = yMin1;
   if (main00.track0.volThumb.x >= yMax1) {
    main00.track0.volThumb.x = yMax1;
   dispatchEvent(new ScrollBarEvent(main00.track0.volThumb.x / yMax));
   e.updateAfterEvent();
  private function sbChange1(e:ScrollBarEvent):void {
   var vol = Math.floor(e.scrollPercent*100)*.01;
   var st:SoundTransform = new SoundTransform(vol);
   if (audioR0 != null) {
    audioR0.soundTransform = st;
  private function auTrackMic(e:Event):void {
   micAct = Math.floor(mic0.activityLevel);
   if (micAct<=0) {
    scale0 =0;
   } else if (micAct>1&&micAct<=15) {
    scale0=0;
   } else if (micAct>15&&micAct<=30) {
    scale0=0;
   } else if (micAct>30&&micAct<=45) {
    scale0=8;
   } else if (micAct>45&&micAct<=60) {
    scale0=8.5;
   } else if (micAct>60&&micAct<=75) {
    scale0=9;
   } else if (micAct>1&&micAct<=80) {
    scale0=9.5;
   } else if (micAct>1&&micAct<=90) {
    scale0=10;
   } else if (micAct>90) {
    scale0=10.5;
   auTrack.scaleX =scale0;
  function RemoveProgBar(e:Event):void {
   ////trace("progbar gone");
   if (progBar.parent !=null) {
    progBar.parent.removeChild(progBar);
  public function metaDataHandler(info:Object):void {
   duration =info.duration;
   trace("+++++++======="+duration);
   if(duration <=1||!duration){
    audioR0.close();
    main00.progBar.progBar.reset;
    main00.progBar.scrubber.x=main00.progBar.progBar.x;
    addEventListener(Event.ENTER_FRAME,FlashTastic,false,0,true);
  private function FlashTastic(e:Event):void{
trace("flashing");
if(flashID==0){
  main00.play_btn.removeEventListener(MouseEvent.MOUSE_DOWN,PlayBack);
  main00.pause_btn.removeEventListener(MouseEvent.MOUSE_DOWN,PausePlayBack);
RemoveListeners();
main00.play_btn.enabled=false;
main00.pause_btn.enabled=false;
main00.progBar.progBar.setProgress(100,100);
main00.progBar.progBar.alpha=0;
flashID=1;
}else{
main00.progBar.progBar.alpha=1;
flashID=0;
private function ChangeHandler(event:Event=null):void {
   if(main00.play_btn.y ==2800 && main00.pause_btn.y==2800){
      main00.play_btn.y =15;
   if(main00.progBar.scrubber.x==0 && main00.progBar.progBar==100){
    main00.progBar.progBar.reset();
   if (oneTime0==0) {
    //main00.progBar.progBar.reset();
    oneTime0=1;
   //amountLoaded = audioR0.time/duration;
         //main00.progBar.progBar.width = amountLoaded*218;
        if(stopScrub==0){
     main00.progBar.scrubber.x = audioR0.time/duration*main00.progBar.progBar.width;
   //main00.progBar.scrubber.x = percent;
   //seconds//getmetadata
   main00.progBar.progBar.setProgress(audioR0.time,duration);
  percent = int(main00.progBar.progBar.percentComplete);
   if(percent ==100){
    main00.progBar.progBar.reset();
    main00.progBar.scrubber.x=main00.progBar.progBar.x;
  private function Mp3Tim(e:TimerEvent){
      if(oneTime1 ==0){
   //dur total number of segments
   var dur=Math.ceil(soundFactory.length/1000);//number of segments
   trace("duration = "+dur);
      inc = 1;
   oneTime1=1;
   inc = (inc++)+1.114;
   trace(inc);
   dur=Math.ceil(soundFactory.length/1000);//number of segments
   progBar.progBar.setProgress(inc,dur);
   //the end of MP3 is delayed by 5 seconds to allow for slight changes multiple mp3 length .
   if(inc >= dur+5){
   Mp3Fin();
  function CompleteHandler(e:Event):void {
   //oneTime0=0;
   progBar.progBar.setProgress(100,100);
  function Mp3Fin():void {
   mp3Tim.stop();
   mp3Tim.reset();
   mp3Tim.removeEventListener(TimerEvent.TIMER,Mp3Tim);
   dispatchEvent(new Event("TYPE_AUDIOSTOP"));
   oneTime0=0;
   progBar.progBar.setProgress(100,100);
            oneTime1=0;
  private function SetListeners():void {
   main00.play_btn.enabled = true;
   main00.pause_btn.enabled= true;
   main00.progBar.scrubber.addEventListener(MouseEvent.MOUSE_DOWN, thumbDown,false,0,true);
   main00.progBar.scrubber.enabled=true;
   main00.stage.addEventListener(MouseEvent.MOUSE_UP, thumbUp,false,0,true);
   main00.track0.volThumb.addEventListener(MouseEvent.MOUSE_DOWN, thumbDown1,false,0,true);
   main00.track0.volThumb.buttonMode=true;
   main00.track0.volThumb.enabled=true;
   main00.stage.addEventListener(MouseEvent.MOUSE_UP, thumbUp1,false,0,true);
   addEventListener(ScrollBarEvent.VALUE_CHANGED, sbChange,false,0,true);
   main00.rw_btn.addEventListener(MouseEvent.CLICK,Rewind,false,0,true);
   main00.rw_btn.buttonMode=true;
   main00.rw_btn.enabled=true;
   main00.ff_btn.addEventListener(MouseEvent.CLICK,FastFD,false,0,true);
   main00.ff_btn.buttonMode=true;
   main00.ff_btn.enabled=true;
  private function RemoveListeners():void {
   main00.progBar.scrubber.removeEventListener(MouseEvent.MOUSE_DOWN, thumbDown);
   main00.progBar.scrubber.enabled=false;
   main00.stage.removeEventListener(MouseEvent.MOUSE_UP, thumbUp);
   main00.track0.volThumb.removeEventListener(MouseEvent.MOUSE_DOWN, thumbDown1);
   main00.track0.volThumb.enabled=false;
   main00.stage.removeEventListener(MouseEvent.MOUSE_UP, thumbUp1);
   removeEventListener(ScrollBarEvent.VALUE_CHANGED, sbChange);
   main00.rw_btn.removeEventListener(MouseEvent.CLICK,Rewind);
   main00.rw_btn.enabled=false;
   main00.ff_btn.removeEventListener(MouseEvent.CLICK,FastFD);
      main00.ff_btn.enabled=false;
  private function DetectEnd(e:NetStatusEvent=null):void {
   //detect end of audio/video file
                trace(e.info.code);
   if(e.info.code=="NetStream.Play.Start"){
    vol=vol;
      tim0.start();
   if (e.info.code == "NetStream.Buffer.Full") {
    removeEventListener(Event.ENTER_FRAME,FlashTastic);
    tim0.stop();
    SetListeners();
   if (e.info.code == "NetStream.Play.Stop") {
    audioTime0=0;
    main00.play_btn.x =main00.pause_btn.x;
       main00.play_btn.y =main00.pause_btn.y;
       main00.pause_btn.x=main00.play_btn.x;
       main00.pause_btn.y=2800;
    if (percent < 100) {
     main00.progBar.progBar.reset();
     percent = int(main00.progBar.progBar.percentComplete);
     main00.progBar.scrubber.x = percent;
     RemoveListeners();
    main00.call0.removeEventListener("TYPE_TIMER",ChangeHandler);
    //dispatchEvent(new Event("TYPE_AUDIOSTOP"));
   if(e.info.code=="NetStream.Buffer.Empty"){
    main00.progBar.progBar.reset();
       main00.progBar.scrubber.x = 0;
    step1=0;
  private function countBuff(e:TimerEvent):void{
   addEventListener(Event.ENTER_FRAME,FlashTastic,false,0,true);
  private function SetAudio(btnID) {
   var determine = e.num0[0].toString().search(".mp3");
   if (determine != -1) {
    //play mp3
    var url=e.num0[0].toString();
    request=new URLRequest(url);
    soundFactory=new Sound  ;
    soundFactory.load(request);
    sFX=soundFactory.play();
   mp3Tim=new Timer(1000,0);
   mp3Tim.addEventListener(TimerEvent.TIMER,Mp3Tim,false,0,true);
   mp3Tim.start();
    main00.call0.addEventListener("TYPE_TIMER",ChangeHandler,false,0,true);
                mp3ID=1;
   } else {
    //play flv
    mp3ID=0;
    if(btnID==0){
     if(main00.uniqueID!=null){
     trace("audio audio");
     main00.call0.addEventListener("TYPE_TIMER",ChangeHandler,false,0,true);
     audioR0.play(main00.uniqueID);
     customClient0 = {onMetaData:metaDataHandler};
     audioR0.client= customClient0;
     video0.attachNetStream(audioR0);
     video0.x=main00.stage.stageWidth/2-video0.width/2;
     video0.y=6;
     addChild(video0);
     removeEventListener(Event.ENTER_FRAME,FlashTastic);
     }else{
     addEventListener(Event.ENTER_FRAME,FlashTastic,false,0,true);
    }else if(btnID==1){
     removeEventListener(Event.ENTER_FRAME,FlashTastic);
    tim0.removeEventListener(TimerEvent.TIMER,countBuff);
    audioR0.togglePause();
    else {
     trace("ok"+e.num0[0]);
     main00.call0.addEventListener("TYPE_TIMER",ChangeHandler,false,0,true);
     customClient0 = {onMetaData:metaDataHandler};
     audioR0.play(e.num0[0].toString());
     audioR0.client= customClient0;
     video0.attachNetStream(audioR0);
     video0.x=186;
     video0.y=245;
     addChild(video0);
  private function RecAudio(e:RecordAudio) {
   var recID = new Date().time;
   audioS0.attachAudio(mic0);
   audioS0.publish(recID.toString(),"live");
   main00.nc1.call("RecordAudio",null,userName00,recID.toString());
class CustomClient0 {
public function onMetaData(info:Object):void {
  //trace("metadata: duration=" + info.duration + " width=" + info.width + " height=" + info.height + " framerate=" + info.framerate);
public function onCuePoint(info:Object):void {
  //trace("cuepoint: time=" + info.time + " name=" + info.name + " type=" + info.type);
public function onPlayStatus(info:Object):void {
  //trace("onPlayStatus");
class CustomClient1 {
//trace("info");
public function onMetaData(info:Object):void {
  //trace("metadata: duration=" + info.duration + " width=" + info.width + " height=" + info.height + " framerate=" + info.framerate);
public function onCuePoint(info:Object):void {
  //trace("cuepoint: time=" + info.time + " name=" + info.name + " type=" + info.type);
public function onPlayStatus(info:Object):void {
  //trace("onPlayStatus");

Similar Messages

  • Scrub Bar Problem

    I have an iPhone 4s and have somehow moved my scrub bar down, so when I am watching a video I have recorded it cuts through it.  Can anyone help me figure out how to move it back to the top of the screen?  Thanks!

    Do a reset (Hold Sleep/Wake and Home buttons about 10 secs or more till Apple logo appears, ignore the Slide to Power Off that appears)
    Note: You will not lose any data.
    If that didn't helped, try restore from backup using iTunes.

  • Issues with Windows Media Player scrub bar

    Here's the problem:
    I've authored a dvd in dvdsp 4, and rigorous testing proved that repeatedly pressing the chapter skip forward/back buttons make the disc do weird stuff. I fixed that by going in and actually setting up the connections etc, disc works fine, no more problems, but now on a PC in windows media player, the scrub bar has no effect on the video. Why?

    Unless each computer is individually set up by the end user to use a recognised DVD codec, Windows Media Player will not play back DVD Video.
    Tell your users to only use the dedicated DVD software player on there computer such as Win DVD

  • Add scrub-bar on netstream video?

    I have a video that im playing via a NetStream, is there a
    way to add a scrub bar (like something a user can drag backwards to
    rewind)
    Thanks

    The black bars (space) on top/bottom or sides of a .swf means that the .swf is being displayed in a container that does not match the aspect ratio of the .swf. By default, a .swf will maintain it’s correct aspect ratio, rather than distort the .swf, even if displayed in a container of the wrong size. So if the container (div for example) does not match exactly the aspect ratio of the .swf, the extra space will display as black space (which are not really bars, rather just empty space).
    Black bars on top/ bottom means that the swf container is not wide enough. Black bars on the sides of the .swf means that the display container is not tall enough.
    Direct download the .swf in a Web browser here and then grab the corner of the browser window and shrink/expand the browser window to illustrate (also note that the black is not part of the .swf):
    http://www.pearlwhitelab.com/WebsiteBanner.swf
    Your <object> code has a couple problems.
    First, in the <object> you have:
    <param name="src" value="http://www.pearlwhitelab.com/WebsiteBannerFinal.swf" >
    yet in the <embed> you have:
    <embed……. src=http://www.pearlwhitelab.com/WebsiteBanner.swf …..
    as you can see, it’s a different file. That’s the reason that the .swf does not display in IE.
    Change that first line to:
    <param name="movie" value=" http://www.pearlwhitelab.com/WebsiteBanner.swf " />
    using the param “movie”. That will fix the display for IE browsers.
    Best wishes,
    Adninjastrator

  • Idvd '08 revolution theme scrub bar

    The revolution theme in idvd '08 has a scrub bar at the bottom of the image frame, with a check box at each end.
    I cannot quite figure out what the check box does, and what the hatched area that appears in the scrub bar does/
    Anyone have a clue on this?
    Thanks.

    The little check boxes at each end are for write in/out. With the boxes checked, when you enter the menu, it will have a cool "entrance" and "exit."
    -David

  • Scrubbing bar that controls many timelines

    Hi all,
    Is it possible for a scrubbing bar on the main stage to control the time lines of many symbols?
    I'm using this code from Sarah Justine
    Create Click and Touch Draggable Scrubbers with Edge Animate CC | sarahjustine.com
    var symDur = sym.getSymbol("timelinePlay").getDuration(); // Get the timeline length of timelinePlay. We'll reference this later in the code.
    var mySymbol = sym.getSymbol("timelinePlayl"); // Get the symbol timelinePlay. We'll reference this later in the code.
    var scrubber = sym.$("scrubber"); // Touch this to scrub the timeline of timelinePlay
    var bar = sym.$("bar"); // Bar the scrubber follows
    sym.$("mobileHit").hide(); // Added an extra invisible div to increase the hit region for mobile (hard to grab otherwise)
    var dragme = false; // Set the initial dragme function to false
    // Detect if mobile device, and if so swap out mouse events for touch events. This is pretty much duplicated code with touch events swapped.
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)) {
        sym.$("mobileHit").show(); // Show the extra invisible div to increase the hit region for mobile (hard to grab otherwise)
        $(function () {
            scrubber.bind("touchstart", function (e) { // Enable the scrib on touchstart
                e.preventDefault(); // Cancels the default action of the mobile device - used to ensure our touch events are fired
                dragme = true;
            scrubber.bind("touchend", function () { // Disable the scrubber on touchend
                e.preventDefault();
                dragme = false;
            scrubber.bind("touchmove", function (e) { // Make the magic happen on touchmove
                if (dragme) {
                    var touch = e.originalEvent.touches[0];
                    var possibleX = touch.pageX;
                    var leftX = bar.offset().left;
                    var rightX = (leftX + bar.width()) - scrubber.width();
                    var scrubWidth = rightX - leftX;
      // Confine the scrubber to the width of the bar
                    if (possibleX < leftX) {
                        possibleX = leftX;
                    if (possibleX > rightX) {
                        possibleX = rightX;
                    scrubber.offset({
                        left: possibleX
                    var relativeX = possibleX - leftX;
                    var stopTimeline = Math.ceil((relativeX / scrubWidth) * symDur); // Make the scrubber scrub the timeline length of timelinePlay
                    mySymbol.stop(stopTimeline); // Stop the timeline of timelinePlay when the scrubber is released
    else $(function () {
        scrubber.mousedown(function () { // Enable the scrubber on mousedown
            dragme = true
        $(document).mouseup(function () { // Disable the scrubber on mouseup
            dragme = false
        $(document).mousemove(function (e) { // Make the magic happen on mousemove
            if (dragme) {
                var possibleX = e.pageX;
                var leftX = bar.offset().left;
                var rightX = (leftX + bar.width()) - scrubber.width();
                var scrubWidth = rightX - leftX;
                // Confine the scrubber to the width of the bar
                if (possibleX < leftX) {
                    possibleX = leftX;
                if (possibleX > rightX) {
                    possibleX = rightX;
                scrubber.offset({
                    left: possibleX
                var relativeX = possibleX - leftX;
                var stopTimeline = Math.ceil((relativeX / scrubWidth) * symDur); // Make the scrubber scrub the timeline length of timelinePlay
                mySymbol.stop(stopTimeline); // Stop the timeline of timelinePlay when the scrubber is released
    What would be the best way to edit it so the scrubbers effected a few symbols?
    At the moment that scrubber is specifically linked to timeLinePlay - but what if we had a few symbols with timelines we could scrub through?
    In my scene there are a few buttons that createChildSymbols in a content box, and I would like the user to scrub through the timeline of each symbol with a scrubber bar.
    I watched a tutorial on variables so attempted writing a few myself but they didn't seem to work, so I just copied the code a few times on the main stage actions and changed the names of the symbols and scrubbers etc - which unfortunately didn't work either.
    I'm sure there is a simple way with variables that this could be achieved
    Does anyone have any ideas??
    Thank you very much in advance for any advice.

    Well I think I've got it..but not quite
    So I changed nothing of the Sarah Justine code above
    But I just added all the animations to the one time line of timeLinePlay and then grouped the elements for each specific animation
    So then when the buttons are clicked they go to timeLinePlay and hide or show the specific groups/ animation.
    So the code looks like this for one of the buttons:
    var myVariable = sym.getComposition().getStage().play("timeLinePlay");
    myVariable.getSymbol("timeLinePlay").$("Group1").show();
    myVariable.getSymbol("timeLinePlay").$("Group2").hide();
    Which works fine - but it only works for the first click. If i navigate to another button that hides and shows a different element then it doesn't work anymore - it shows nothing
    So I tried resetting the timeLinePlay animation with this:
    document.compositionReady:
    sym.resetTimeLinePlay = function() {
    getSymbol("timeLinePlay").$("Group1").hide();
    getSymbol("timeLinePlay").$("Group1").hide();
    buttons:
    sym.getComposition().getStage().resetTimeLinePlay();
    But thats not working either - I assume because straight after the reset, the button also says - to play timeline and hide and show elements so its obviously getting confused.
    Would anyone possibly know how to fix this?
    Thanks you so much in advance

  • Can't view audio controls (time remaining, scrub bar, etc.) in os5 on iPhone 4

    Since upgrading to OS5, my iPhone 4 won't display the audio controls during music or podcast playback.
    Very annoying since I really liked the time remaining and scrub features that I had before.
    Is this a bug?  Or is there some setting control that I haven't yet found to re-enable these features?

    Just found the solution on a different thread.
    Turns out that the audio controls can be toggled on and off, though this isn't explained in the manuals.
    paraphrased from the other solution:
    "While your audio file is playing,  double-tap and hold (on the album artwork) until the scrubbing bar reappears.
    A double tap doesn't seem to do it. You have to hold the second tap down to get it to work. Don't lift your finger from the second tap until the scrubbing bar re-appears. "

  • Where's the scrub bar

    First time playin' around with iMovie 6. I cannot seem to bring up the scrub bar for audio (audio wavelength). I go to "view" and check the "show audio wave length" but nothing happens. Is there a button I am missing. Thats all you had to do in iMovie 5 was check that button. Or maybe something has to be turned off first. Any help will be greatly appreciated!
    Thanks,
    Rob

    Thats a good idea. I never thought of that. When I get that serious I usually do the editing in Final Cut. It has a sound program appropiately called "Soundtrack" which is like Garage band with your movie attached. It has over 4000 loops and special sound effects. But I love iMovie too especially for slide shows and video emails. Unfortunately everything in FC is manual... nothing much is automated. I am going to try that suggestion in iMovie to see how it works.
    I had made a 30 second clip for email and I coughed at the begining. Thats what I wanted to take out in iMovie but leave the video in tact. In FC it would have just taken a second.

  • Am I The Only One Who Wants A Decent Scrub Bar?

    On both my iPhone and iPad I REALLY hate the inadequate scrub bar. I know I have fat fingers but to try to replay a a few minutes - or fast forward - it's nearly impossible to get even in the vicinity of where I need to get with the current bar.
    How about keeping the current scrub bar to show progress, but you should be able to tap on it to get a large scrub wheel for accurate fast forward or rewind. There could be a 1x 2x or 3x indicator in the center each time you tap it to adjust the scrub speed.
    I listen to podcasts on my iPhone and iPad every day and this is driving me nuts. Is this one of those insider secrets that's already there and I don't know it?

    When scrubbing, slide your finger down the screen to slow down the scrub rate.
    Page 77... http://manuals.info.apple.com/en_US/iphone_user_guide.pdf

  • Scrub bar for SWFs

    what i am looking for is an FLV player type component (doesn't have to be an actual component) that will play SWFs. i need it to have all the same functionality (play, pause, scrub bar, etc...) it seems crazy that there isn't one out there i have even looked in the Exchange area and only seem to find ones that control FLVs or MOVs, not SWFs.
    thanks

    The reason there probably isn't a component for swf's is that by their nature, swf's are self-controlled, intended to play in a certain manner with controls provided in them if/as needed to make things play properly.  This includes the provision of movieclips within swf's which can act as movies within movies within movies.... etc.  So to have a component to play swf's would require having some kind of standardized swf design to control, such as a strict animation (no buttons, no movieclips, just frame by frame animation).
    You shouldn't really have much trouble making a player yourself for whatever version of swf you are thinking fits the bill.  If you visit the AS3 forum today you'll find a discussion about scrubbing the timeline which should prove useful to your cause, and as far as play and pause buttons go... that's a simmple matter of implementing buttons that call on play() and stop() functions.

  • Scrub bar on A/V files?

    Is there an easy way to give A/V files (probably WMV and/or
    mp3) a scrub bar a la Quicktime-- without using Quicktime?
    Thanks!

    yeah dude. If you open the ZEN V series media explorer, there is an option to convert video for ZEN V Plus. After you use that to convert your .avi files you can add them to your player.
    .....PORN?ON THE GO!! (JUST KIDDDING)? or am I?no I seriously am kidding, that?would be?gross.

  • Scrub bar help

    Hey everyone, so i need to make a scrub bar that works for
    the timeline in my .fla. I was trying my hand at it but I barely
    code at all and I'm not sure why this wouldn't work for the first
    steps:
    I made an octagon that just tweens across the screen. I don't
    know if the below syntax is correct so don't laugh at me : ). Scrub
    is the mc name of the little bar i want dragged. 30 is the amount
    of frames in the tween. 322.9 is the width of the bar on top of
    which scrub is being dragged. With this code I was hoping the bar
    would slide across automatically while the animation played. Please
    help!! Also if anyone knows the next step for making the bar
    clickable with my mouse and allowing me to drag it that would be
    most appreciated!
    var i:Number = oct._currentframe;
    while (i < 30) {
    scrub._x = oct._currentframe/30 * 322.9;
    var i:Number = oct._currentframe;

    This and more can be found in the manual:
    http://manuals.info.apple.com/enUS/iPhone_UserGuide.pdf

  • [svn:osmf:] 14326: ChromeLibrary: fixing hints from appearing at the wrong vertical offset, and preventing scrub bar time remaining calculations to go negative.

    Revision: 14326
    Revision: 14326
    Author:   [email protected]
    Date:     2010-02-22 08:10:39 -0800 (Mon, 22 Feb 2010)
    Log Message:
    ChromeLibrary: fixing hints from appearing at the wrong vertical offset, and preventing scrub bar time remaining calculations to go negative.
    Modified Paths:
        osmf/trunk/libs/ChromeLibrary/src/org/osmf/chrome/controlbar/widgets/ScrubBar.as
        osmf/trunk/libs/ChromeLibrary/src/org/osmf/chrome/hint/Hint.as

  • Scrub bar and its ability to pause

    I'm considering a purchase of Apple Quicktime Pro but I'd like to know if it can perform a specific function that I have in mind while it is embedded into a browser.
    You see, I work a for a research center that has an electron microscope. The EM lab creates these fascinating 3D movies of a 360 degree views of microscopic particles. The movies essentially rotate around a target and pictorialize the structure of the particles.
    The EM lab would like to take these movies, which are in AVI format, and post them online. However, they would like the user who (who is viewing the movie files from within a browser) to be able to scrub through it and pause, in order to view the particles at different angles.
    Essentially, my question is this. Can Quicktime allow a user to scrub through a video, let up on the scrub bar, and have it PAUSE instead of play at that point? This would, in essence, make the scrub bar less of a position to start playing a video file and more of an indication of a vantage point of that particle. Is this clear?
    Thanks,
    Paul
    IBM   Windows XP Pro  

    The scrub will reflect whatever the state of playback is at the time. That is, if the movie isn't playing to begin with, the user can scrub to any point and the movie will not automatically start playing. If the movie is playing, then the movie will continue to play after the pointer is dragged to the new location.

  • Slider or scrub bar per slide

    Hi Folks,
    Does anyone know how to create a slider or scrub bar per slide. The one that comes with the Captivate 5 skin is a slider for the entire duration of the project. I need one specific to each slide.
    Thanks,
    Chris

    There is no standard object in Captivate that will give you a scrub/slider bar for an individual slide that would enable a user to move at will from the first frame of the slide to the last and any point in between.
    The default slider on a Captivate playbar is the closest you get out of the box.

Maybe you are looking for

  • How can I import my old songs

    I am trying to move my music from my old computer to my new one. I already tried transferring purchases on my ipod nano,  tried home sharing, tried importing playlists but the playlists only save as text or M3U files. I am missing almost 1000 songs t

  • How to align output formatted and output text in the same line?

    Hi All, I want an output formatted label and a text on the same line,. I've surrounded these components wth a panel form layout and they automatically align one below the other. how do I kepe them in the same line? Thanks.

  • Best way to upload photos from iPhone 3GS?

    I have an iPhone 3GS. I just took a bunch of photos on vacation. Now I would like to upload them to my Windows XP PC. I know I can send them via email one at a time, but I'd like a way to send them all at once. I do have a Dropbox account. I tried to

  • Satellite L500-1WP - Higher screen resolution than HD?

    Good day! I use Toshiba Satellite L500-1WP. I have bought a new monitor Dell U2711 with max resolution 2560x1440. I tryed to connect this monitor to my computer using HDMI cable, the video card identifies that monitor as an HD TV and makes max. resol

  • Lenovo t520 screen going dark

    My lenovo t520 just came back from the repair center to get a new motherboard and I have started noticing a weird issue with the screen. Whenever I go on a website that is primarily dark (like the bckground is black), the screen gets quite dark. And