video duration
How to get video duration in as3 ?
How to get video duration in as3 ?
I changed this total duration of video.
but some issus
msg is
| Scene 1, Layer 'Actions', Frame 1, Line 509 | 1067: Implicit coercion of a value of type String to an unrelated type Number. |
var newMeta:Object = new Object();
newMeta.onMetaData = onMetaData;
var vFrame:MovieClip=new MovieClip();
this.addChild(vFrame);
vFrame.addEventListener(Event.ENTER_FRAME, videoStatus);
function onMetaData(newMeta:Object):void
{
duration = newMeta.duration;
var hours2:Number;
var minutes2:Number;
var seconds2:Number;
var durminutes = duration/60;
hours2 = Math.floor(durmin/60);
if (duration>=3600) {
minutes2 = Math.floor(durmin%60);
} else {
minutes2 = Math.floor(duration/60);
}
seconds2 = Math.floor(duration%60);
if (hours2<10) {
hours2 = "0"+hours2;
}
if (minutes2<10) {
minutes2 = "0"+minutes2;
}
if (seconds2<10) {
seconds2 = "0"+seconds2;
}
trace (hours2+":"+minutes2+":"+seconds2);
}
function videoStatus():void
{
amountLoaded = ns.bytesLoaded/ns.bytesTotal;
controls.seekbar.loadBar.width = amountLoaded*330;
controls.seekbar.scrubber.x = ns.time/duration*320;
}
You declared hours2, minutes2,etc. as Numbers but attempt to use them as Strings - hence the error.
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.