var listenerScrub:Object = new Object(); listenerScrub.scrubFinish = function(e:Object):Void { Debug.trace("Scrubbing stopped at " + e.playheadTime); Debug.trace("Current state is " + e.state); Debug.trace("Duration : " + _root.duration); var tofind = Math.floor(e.playheadTime*1000); var percent_time = ((e.playheadTime*1000) / _root.duration)*100; var percent_bytes = (_root.flv_cmp.bytesLoaded / _root.flv_cmp.bytesTotal)*100; if(percent_time > percent_bytes){ for (var i:Number=0; i < _root.times.length; i++){ var j = i + 1; if( (_root.times[i] <= tofind) && (_root.times[j] >= tofind ) ){ Debug.trace("match at " + _root.times[i] + " and " + _root.positions[i]); _root.flv_cmp.stop(); player.loadMedia( _phpURL + "?file=" + _vidName + "&to=" + _root.positions[i]); Debug.trace("play " + _phpURL + "?file=" + _vidName + "&position=" + _root.positions[i]); isForwarded=true; stats_hit('forward'); break; }}}}; _root.flv_cmp.addEventListener("scrubFinish", listenerScrub);