Copy link to clipboard
Copied
Total time fine, playing fine, scrubber click fine. But
only if i move scrubber message is showing in output
ArgumentError: Error #1063: Argument count mismatch on Player_as3_fla::MainTimeline/videoStatus(). Expected 1, got 0.
at Function/http://adobe.com/AS3/2006/builtin::apply()
at SetIntervalTimer/onTimer()
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()
Now My script is
var newMeta:Object = new Object();
newMeta.onMetaData = onMetaData;
ns.client=this;
var amountLoaded:Number;
var duration = Number;
var vFrame:MovieClip=new MovieClip();
this.addChild(vFrame);
vFrame.addEventListener(Event.ENTER_FRAME, videoStatus);
function onMetaData(newMeta:Object):void
{
duration = newMeta.duration;
var durmin = duration/60;
var hours = Math.floor(durmin/60);
if (duration>=3600) {
var minutes = Math.floor(durmin%60);
}
else{
minutes = Math.floor(duration/60);
}
var seconds = Math.floor(duration%60);
if (hours2<10) {
hours = "0"+hours;
}
if (minutes<10) {
minutes = "0"+minutes;
}
if (seconds<10) {
seconds = "0"+seconds;
}
controls.totalTime.text= hours+":"+minutes+":"+seconds;
}
function videoStatus(event:Event):void
{
amountLoaded = ns.bytesLoaded/ns.bytesTotal;
controls.seekbar.loadBar.width = amountLoaded*330;
controls.seekbar.scrub.x = ns.time/duration*320;
}
I see that you are calling this videoStatus function from Event.ENTER_FRAME handler and also with a timer after dragging scrubber. I believe the problem is that while you are dragging scrubber, the enterFrame function is settings position of the scrubber -> the conflict.
I would change this line
vFrame.addEventListener(Event.ENTER_FRAME, videoStatus);
to
videoInterval = setInterval(videoStatus, 100);
Copy link to clipboard
Copied
change videoStatus function to:
function videoStatus(event:Event = null):void
{
amountLoaded = ns.bytesLoaded/ns.bytesTotal;
controls.seekbar.loadBar.width = amountLoaded*330;
controls.seekbar.scrub.x = ns.time/duration*320;
}
Copy link to clipboard
Copied
Do you have other code for whatver you are calling the scrubber?
Copy link to clipboard
Copied
i put this
null):void
now error is gone, but srubber not correctly moving through mouse move.
Other Code is
function videoStatus(event:Event = null):void
{
amountLoaded = ns.bytesLoaded/ns.bytesTotal;
controls
.seekbar.loadBar.width = amountLoaded*330;
controls
.seekbar.scrub.x = ns.time/duration*320;}
function videoScrubberDown(event:MouseEvent):void
{
var bounds:Rectangle = new Rectangle(0,0,320,0);
clearInterval(videoInterval);
scrubInterval = setInterval(scrubTimeline, 10);
controls.seekbar.scrub.startDrag(false, bounds);
stage.addEventListener(MouseEvent.MOUSE_UP, stopScrubbingVideo);
}
function scrubTimeline():void
{
ns.seek(Math.floor((controls.seekbar.scrub.x/320)*duration));
}
function stopScrubbingVideo(Event:MouseEvent):void
{
stage.removeEventListener(MouseEvent.MOUSE_UP, stopScrubbingVideo);
clearInterval(scrubInterval);
videoInterval = setInterval(videoStatus, 100);
controls.seekbar.scrub.stopDrag();
}
function clickableScrubber(Event:MouseEvent):void
{
controls.seekbar.scrub.x= controls.seekbar.btnProgressBar.mouseX;
controls.seekbar.scrub.x= controls.seekbar.mouseX;
ns.seek(Math.floor((controls.seekbar.scrub.x/320)*duration));
}
Copy link to clipboard
Copied
I see that you are calling this videoStatus function from Event.ENTER_FRAME handler and also with a timer after dragging scrubber. I believe the problem is that while you are dragging scrubber, the enterFrame function is settings position of the scrubber -> the conflict.
I would change this line
vFrame.addEventListener(Event.ENTER_FRAME, videoStatus);
to
videoInterval = setInterval(videoStatus, 100);
Copy link to clipboard
Copied
Yaa it's Working fine.
Thankyou.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now