/* June 2007 FlvPlayer 8 Copyright © 2007 by Andrei Potorac andrei_potorac@yahoo.com All rights reserved. */ Stage.scaleMode = "noScale"; this._lockroot = true; Stage.align = "TL"; import flash.display.BitmapData; /******************** General settings ********************/ if(stagew == undefined){ var stagew:Number = 407; }else{ stagew = int(stagew); } if(stageh == undefined){ var stageh:Number = 305; }else{ stageh = int(stageh); } if(newWidth == undefined){ var newWidth:Number = 407; }else{ newWidth = int(newWidth); } if(newHeight == undefined){ var newHeight:Number = 305; }else{ newHeight = int(newHeight); } var nrFrames:Number = 24; // Uncomment this piece of code to make the player work from flash. /* _root.imagePath = "800x336.jpg"; _root.videoPath = "800x336.flv"; _root.autoStart = "false"; _root.volAudio = 60; */ /******************** SOUND ********************/ _root.createEmptyMovieClip("vSound", _root.getNextHighestDepth()); function setAudio(val):Void { _root.mcVideoPlayer.mcControlPanel.mcAudio.mcScrub._x = Math.round(val/100*_root.endAudioPosition+_root.startAudioPosition); _root.changeColor(val); } _root.mcVideoPlayer.myVideo._width = stagew; _root.mcVideoPlayer.myVideo._height = stageh; _root.mcVideoPlayer.mcSkin._width = stagew; _root.mcVideoPlayer.mcSkin._height = stageh; /******************** VARIABLES ********************/ var audioInterval:Number; var startAudioPosition:Number = _root.mcVideoPlayer.mcControlPanel.mcAudio.mcScrub._x; var endAudioPosition:Number = _root.mcVideoPlayer.mcControlPanel.mcAudio.mcScrub._x+_root.mcVideoPlayer.mcControlPanel.mcAudio.mcAudioLine._width-_root.mcVideoPlayer.mcControlPanel.mcAudio.mcScrub._width-_root.startAudioPosition+1; var startPosition:Number = _root.mcVideoPlayer.mcControlPanel.mcScrub._x; var endPosition:Number = Math.round(_root.mcVideoPlayer.mcControlPanel.mcVideoLoader._width+_root.mcVideoPlayer.mcControlPanel.mcVideoLoader._x-_root.mcVideoPlayer.mcControlPanel.mcScrub._width)-startPosition+_root.mcVideoPlayer.mcControlPanel.mcScrub._width/2+1; var settingsArray:Array = new Array(); var videoDuration:Number; var videoInterval:Number; var scrubInterval:Number; var vStatusNumber:Number = 0; var rememberValue:Number = 0; var speed:Number = 20; var isFirst:Boolean = true; var isLoading:Boolean = true; var isPaused:Boolean = true; var disablePlayButton:Boolean = false; var soundColor:String = "0xffffff"; var muteColor:String = "0x626262"; _root.mcVideoPlayer.loader._visible = false; _root.mcVideoPlayer.mcBuffering._visible = false; _root.mcVideoPlayer.mcControlPanel.butPause._visible = false; _root.mcVideoPlayer.mcPause.butPause._visible = false; _root.mcVideoPlayer.mcPause._visible = false; _root.mcVideoPlayer.mcControlPanel.mcBackCP.mc.butBack.useHandCursor = false; _root.mcVideoPlayer.mcControlPanel.mcAudio.mcAudioSign.mcSpeaker.setColor(_root.soundColor); _root.mcVideoPlayer.mcControlPanel.mcAudio.mcAudioSign.mcL1.mcShape.setColor(_root.soundColor); _root.mcVideoPlayer.mcControlPanel.mcAudio.mcAudioSign.mcL2.mcShape.setColor(_root.soundColor); _root.mcVideoPlayer.mcControlPanel.mcAudio.mcAudioSign.mcL3.mcShape.setColor(_root.soundColor); /******************** This function is used to readjust the size and position of the elements, when the video is set to play full screen ********************/ var initialWidth:Number = _root.mcVideoPlayer.myVideo._width; var initialHeight:Number = _root.mcVideoPlayer.myVideo._height; var initialMaskLineWidth:Number = stagew-_root.mcVideoPlayer.mcControlPanel.mcMaskLine._width; var initialmcFullScreenX:Number = stagew - _root.mcVideoPlayer.mcControlPanel.mcFullScreen._x; var initialmcTimerX:Number = stagew - _root.mcVideoPlayer.mcControlPanel.mcTimer._x; var initialmcAudioX:Number = stagew - _root.mcVideoPlayer.mcControlPanel.mcAudio._x; var initialmcLineX:Number = stagew - _root.mcVideoPlayer.mcControlPanel.mcLine._x; function onResize():Void{ stagew=Stage.width; stageh=Stage.height; if(Stage["displayState"] == "normal"){ _root.full= false; }else{ _root.full= true; } _root.mcVideoPlayer.loader._x = (stagew-_root.mcVideoPlayer.loader._width)/2; _root.mcVideoPlayer.loader._y = (stageh-_root.mcVideoPlayer.loader._height)/2; // what's the new % of the width. It can be 130% for example. ratio = (stagew*100)/newWidth; tempHeight = (ratio*(newHeight-25))/100; _root.mcVideoPlayer.myVideo._width = stagew; _root.mcVideoPlayer.myVideo._height = tempHeight; _root.mcVideoPlayer.maskImages._width = stagew; _root.mcVideoPlayer.maskImages._height = tempHeight; _root.mcVideoPlayer.maskImages._x = _root.mcVideoPlayer.myVideo._x; _root.mcVideoPlayer.maskImages._y = _root.mcVideoPlayer.myVideo._y; _root.mcVideoPlayer.imageControl._xscale = Math.round((100*stagew)/newWidth); _root.mcVideoPlayer.imageControl._yscale = _root.mcVideoPlayer.imageControl._xscale; _root.mcVideoPlayer.mcControlPanel._y = stageh-_root.mcVideoPlayer.mcControlPanel._height; if(full == true){ center = (_root.mcVideoPlayer.mcControlPanel._y-(_root.mcVideoPlayer.myVideo._y+tempHeight))/2; _root.mcVideoPlayer.myVideo._y += center; }else{ _root.mcVideoPlayer.myVideo._y = 0; _root.mcVideoPlayer.imageControl._y = 0; _root.mcVideoPlayer.maskImages._y = 0; } _root.mcVideoPlayer.maskImages._x = _root.mcVideoPlayer.myVideo._x; _root.mcVideoPlayer.maskImages._y = _root.mcVideoPlayer.myVideo._y; _root.mcVideoPlayer.imageControl._x = _root.mcVideoPlayer.myVideo._x; _root.mcVideoPlayer.imageControl._y = _root.mcVideoPlayer.myVideo._y; _root.mcVideoPlayer.mcControlPanel.mcBackCP.mc._width = stagew; _root.mcVideoPlayer.mcPlay._x = Math.ceil((stagew-_root.mcVideoPlayer.mcPlay._width)/2); _root.mcVideoPlayer.mcPlay._y = Math.ceil((stageh-_root.mcVideoPlayer.mcPlay._height)/2); _root.mcVideoPlayer.mcPause._x = Math.ceil((stagew-_root.mcVideoPlayer.mcPause._width)/2); _root.mcVideoPlayer.mcPause._y = Math.ceil((stageh-_root.mcVideoPlayer.mcPause._height)/2); _root.mcVideoPlayer.mcBuffering._x = Math.round(stagew-163); _root.mcVideoPlayer.mcControlPanel.mcMaskLine._width = stagew-initialMaskLineWidth; _root.mcVideoPlayer.mcControlPanel.mcPlayed._width = stagew-initialMaskLineWidth; _root.mcVideoPlayer.mcControlPanel.mcPlayed._x = -(stagew-initialMaskLineWidth)+_root.mcVideoPlayer.mcControlPanel.mcScrub._x; _root.mcVideoPlayer.mcControlPanel.mcVideoLoader._width = stagew-initialMaskLineWidth; _root.mcVideoPlayer.mcControlPanel.mcFullScreen._x = stagew-initialmcFullScreenX; _root.mcVideoPlayer.mcControlPanel.mcTimer._x = stagew-initialmcTimerX; _root.mcVideoPlayer.mcControlPanel.mcAudio._x = stagew-initialmcAudioX; _root.mcVideoPlayer.mcControlPanel.mcLine._x = stagew-initialmcLineX; _root.endPosition = Math.round(_root.mcVideoPlayer.mcControlPanel.mcVideoLoader._width+_root.mcVideoPlayer.mcControlPanel.mcVideoLoader._x-_root.mcVideoPlayer.mcControlPanel.mcScrub._width)-startPosition+_root.mcVideoPlayer.mcControlPanel.mcScrub._width/2; } var full:Boolean = false; Stage["displayState"] = "normal"; Stage.addListener(this); onResize(); // functions to enter and leave full screen mode function goFullScreen() { _root.full = true; Stage["displayState"] = "fullScreen"; } function exitFullScreen() { _root.full= false; Stage["displayState"] = "normal"; } _root.mcVideoPlayer.mcControlPanel.mcFullScreen.but.onRelease=function():Void{ if(_root.full == false){ _root.goFullScreen(); }else if(_root.full == true){ _root.exitFullScreen(); } } /******************** ADD ITEMS TO RIGHT CLICK MENU ********************/ // function to enable, disable context menu items, based on which mode we are in. function menuHandler(obj, menuObj) { if (Stage["displayState"] == "normal") { // if we're in normal mode, enable the 'go full screen' item, disable the 'exit' item menuObj.customItems[0].enabled = true; menuObj.customItems[1].enabled = false; } else { // if we're in full screen mode, disable the 'go full screen' item, enable the 'exit' item menuObj.customItems[0].enabled = false; menuObj.customItems[1].enabled = true; } } // create a new context menu var fullscreenCM:ContextMenu = new ContextMenu(menuHandler); // hide the regular built-in items fullscreenCM.hideBuiltInItems(); // add the items to enter and leave full screen mode var fs:ContextMenuItem = new ContextMenuItem("Go Full Screen", goFullScreen); fullscreenCM.customItems.push(fs); var xfs:ContextMenuItem = new ContextMenuItem("Exit Full Screen", exitFullScreen); fullscreenCM.customItems.push(xfs); // _root.menu = fullscreenCM; /******************** LISTNER FOR INITIAL IMAGE ********************/ var listnerGallery:Object = new Object(); listnerGallery.onLoadInit = function(mc:MovieClip) { bmp = new BitmapData(mc._width, mc._height, true, ffffff); bmp.draw(mc); mc.attachBitmap(bmp, 1, "auto", true); _root.mcVideoPlayer.loader._visible = false; _root.mcBuffering._visible = false; mc._alpha = 100; }; var objGallery:MovieClipLoader = new MovieClipLoader(); objGallery.addListener(listnerGallery); /******************** LOAD IMAGES ********************/ function loadImage():Void { _root.isLoading = true; _root.mcVideoPlayer.imageControl._alpha = 0; _root.objGallery.loadClip(_root.imagePath, _root.mcVideoPlayer.imageControl); _root.mcVideoPlayer.loader._visible = true; } /******************** PAUSE VIDEO BUTTON ********************/ _root.mcVideoPlayer.mcControlPanel.butPause.onRelease = function():Void { _root.isPaused = true; _root.ns.pause(true); _root.mcVideoPlayer.mcControlPanel.butPause._visible = false; _root.mcVideoPlayer.mcPause.butPause._visible = false; _root.mcVideoPlayer.mcControlPanel.butPlay._visible = true; if(disablePlayButton == false){ _root.mcVideoPlayer.mcPlay.butPlay._visible = true; } }; _root.mcVideoPlayer.mcPause.butPause.onRelease = function():Void { _root.isPaused = true; _root.ns.pause(true); _root.mcVideoPlayer.mcControlPanel.butPause._visible = false; _root.mcVideoPlayer.mcPause.butPause._visible = false; _root.mcVideoPlayer.mcControlPanel.butPlay._visible = true; if(disablePlayButton == false){ _root.mcVideoPlayer.mcPlay.butPlay._visible = true; } }; /******************** PLAY VIDEO BUTTON ********************/ _root.mcVideoPlayer.mcControlPanel.butPlay.onRelease = function():Void { _root.loadVideo(); }; _root.mcVideoPlayer.mcPlay.butPlay.onRelease = function():Void { _root.loadVideo(); }; function loadVideo() { _root.isPaused = false; _root.mcVideoPlayer.mcControlPanel.butPlay._visible = false; _root.mcVideoPlayer.mcPlay.butPlay._visible = false; delete _root.mcVideoPlayer.imageControl.onEnterFrame(); if (_root.isFirst == true) { _root.isFirst = false; _root.mcVideoPlayer.loader._visible = false; // if the image is loaded, the video can start after the image fades out if (_root.isLoading == false) { _root.mcVideoPlayer.imageControl.fade("out", _root.speed, _root.playVideo); _root.mcVideoPlayer.mcControlPanel.butPause.enabled = false; _root.mcVideoPlayer.mcPause.butPause.enabled = false; _root.isLoaded = true; } else { // if the image is still loading, no image - no fading. Start the video _root.playVideo(); _root.mcVideoPlayer.imageControl.fade("out", _root.speed); _root.isLoaded = false; } } else { _root.ns.pause(false); } _root.mcVideoPlayer.mcControlPanel.butPause._visible = true; _root.mcVideoPlayer.mcPause.butPause._visible = true; } /******************** STOP VIDEO BUTTON ********************/ _root.mcVideoPlayer.mcControlPanel.butStop.onRelease = function():Void { if (_root.isPaused == false) { ns.pause(); _root.isPaused = true; } clearInterval(_root.videoInterval); _root.mcVideoPlayer.mcControlPanel.mcVideoLoader.mcMask._xscale = 0; _root.vStatusNumber = 0; _root.mcVideoPlayer.mcBuffering._visible = false; _root.mcVideoPlayer.mcControlPanel.butPause._visible = false; _root.mcVideoPlayer.mcPause.butPause._visible = false; _root.mcVideoPlayer.mcControlPanel.butPlay._visible = true; _root.mcVideoPlayer.mcPlay.butPlay._visible = true; _root.mcVideoPlayer.mcControlPanel.mcScrub._x = _root.startPosition; _root.mcVideoPlayer.mcControlPanel.mcPlayed._x = _root.mcVideoPlayer.mcControlPanel.mcScrub._x; _root.mcVideoPlayer.mcControlPanel.mcTimer.tPassedTime.htmlText = "00:00"; _root.mcVideoPlayer.mcControlPanel.mcTimer.tTotalTime.htmlText = "00:00"; ns.pause(true); if (_root.isLoaded == true) { _root.mcVideoPlayer.imageControl._alpha=100; _root.mcVideoPlayer.imageControl.fade("in", _root.speed); _root.mcBuffering._visible = false; } else { _root.loadImage(); } _root.mcVideoPlayer.myVideo._visible = false; _root.isFirst = true; }; /******************** VIDEO SCRUB ********************/ function playVideo():Void { _root.mcVideoPlayer.mcControlPanel.butPause.enabled = true; _root.mcVideoPlayer.mcPause.butPause._visible = true; _root.ns.play(_root.videoPath); clearInterval(_root.videoInterval); _root.videoInterval = setInterval(_root.videoStatus, 10); } function videoStatus():Void { _root.vStatusNumber = Math.round(_root.ns.bytesLoaded/_root.ns.bytesTotal*100); if (_root.vStatusNumber<=100) { _root.mcVideoPlayer.mcControlPanel.mcVideoLoader.mcMask._xscale = _root.vStatusNumber; } if (_root.videoDuration != undefined && _root.isPaused == false) { _root.mcVideoPlayer.mcControlPanel.mcScrub._x = _root.startPosition+_root.ns.time/_root.videoDuration*_root.endPosition+_root.mcVideoPlayer.mcControlPanel.mcScrub._width/2; _root.mcVideoPlayer.mcControlPanel.mcPlayed._x = _root.mcVideoPlayer.mcControlPanel.mcScrub._x; _root.showTime(_root.ns.time); } } function showTime(id:Number):Void { var minutes:Number = int((int(id))/60); var seconds:Number = (int(id))%60; if (minutes<10) { var m = "0"+minutes; } else { var m = minutes; } if (seconds<10) { var s = "0"+seconds; } else { var s = seconds; } _root.mcVideoPlayer.mcControlPanel.mcTimer.tPassedTime.htmlText = m+":"+s; } /******************** AUDIO BUTTON ********************/ _root.mcVideoPlayer.mcControlPanel.mcAudio.mcScrub.but.onPress = function():Void { clearInterval(_root.audioInterval); _root.audioInterval = setInterval(_root.scrubAudio, 10); _root.mcVideoPlayer.mcControlPanel.mcAudio.mcScrub.startDrag(false, _root.startAudioPosition, _root.mcVideoPlayer.mcControlPanel.mcAudio.mcScrub._y, _root.endAudioPosition+_root.startAudioPosition, _root.mcVideoPlayer.mcControlPanel.mcAudio.mcScrub._y); }; _root.mcVideoPlayer.mcControlPanel.mcAudio.mcScrub.but.onRelease = _root.mcVideoPlayer.mcControlPanel.mcAudio.mcScrub.but.onReleaseOutside=function ():Void { clearInterval(_root.audioInterval); _root.mcVideoPlayer.mcControlPanel.mcAudio.mcScrub.stopDrag(); }; function scrubAudio():Void { v = Math.floor((((_root.mcVideoPlayer.mcControlPanel.mcAudio.mcScrub._x-_root.startAudioPosition)/_root.endAudioPosition)*100)); _root.changeColor(v); } function changeColor(v):Void { _root.backSound.setVolume(v); if (v == 0) { _root.mcVideoPlayer.mcControlPanel.mcAudio.mcAudioSign.mcSpeaker.setColor(_root.muteColor); _root.mcVideoPlayer.mcControlPanel.mcAudio.mcAudioSign.mcL1.mcShape.setColor(_root.muteColor); _root.mcVideoPlayer.mcControlPanel.mcAudio.mcAudioSign.mcL2.mcShape.setColor(_root.muteColor); _root.mcVideoPlayer.mcControlPanel.mcAudio.mcAudioSign.mcL3.mcShape.setColor(_root.muteColor); } else { _root.mcVideoPlayer.mcControlPanel.mcAudio.mcAudioSign.mcSpeaker.setColor(_root.soundColor); _root.mcVideoPlayer.mcControlPanel.mcAudio.mcAudioSign.mcL1.mcShape.setColor(_root.soundColor); _root.mcVideoPlayer.mcControlPanel.mcAudio.mcAudioSign.mcL2.mcShape.setColor(_root.soundColor); _root.mcVideoPlayer.mcControlPanel.mcAudio.mcAudioSign.mcL3.mcShape.setColor(_root.soundColor); } if (v == 0) { _root.mcVideoPlayer.mcControlPanel.mcAudio.mcAudioSign.mcL1._visible = false; _root.mcVideoPlayer.mcControlPanel.mcAudio.mcAudioSign.mcL2._visible = false; _root.mcVideoPlayer.mcControlPanel.mcAudio.mcAudioSign.mcL3._visible = false; }else{ _root.mcVideoPlayer.mcControlPanel.mcAudio.mcAudioSign.mcL1._visible = true; _root.mcVideoPlayer.mcControlPanel.mcAudio.mcAudioSign.mcL2._visible = true; _root.mcVideoPlayer.mcControlPanel.mcAudio.mcAudioSign.mcL3._visible = true; } if (v<=33 && v>0) { _root.mcVideoPlayer.mcControlPanel.mcAudio.mcAudioSign.mcL1._visible = true; _root.mcVideoPlayer.mcControlPanel.mcAudio.mcAudioSign.mcL2._visible = false; _root.mcVideoPlayer.mcControlPanel.mcAudio.mcAudioSign.mcL3._visible = false; } if (v<=66 && v>33) { _root.mcVideoPlayer.mcControlPanel.mcAudio.mcAudioSign.mcL1._visible = true; _root.mcVideoPlayer.mcControlPanel.mcAudio.mcAudioSign.mcL2._visible = true; _root.mcVideoPlayer.mcControlPanel.mcAudio.mcAudioSign.mcL3._visible = false; } if (v>66) { _root.mcVideoPlayer.mcControlPanel.mcAudio.mcAudioSign.mcL1._visible = true; _root.mcVideoPlayer.mcControlPanel.mcAudio.mcAudioSign.mcL2._visible = true; _root.mcVideoPlayer.mcControlPanel.mcAudio.mcAudioSign.mcL3._visible = true; } } _root.mcVideoPlayer.mcControlPanel.mcAudio.mcAudioSign.but.onRelease = function():Void { if (_root.backSound.getVolume() != 0) { _root.rememberValue = _root.backSound.getVolume(); _root.backSound.setVolume(0); _root.changeColor(0); _root.mcVideoPlayer.mcControlPanel.mcAudio.mcScrub._x = Math.round(_root.startAudioPosition); } else { _root.backSound.setVolume(_root.rememberValue); _root.changeColor(_root.rememberValue); _root.mcVideoPlayer.mcControlPanel.mcAudio.mcScrub._x = _root.rememberValue/100*_root.endAudioPosition+_root.startAudioPosition; } }; /******************** SCRUB BUTTON ********************/ _root.mcVideoPlayer.mcControlPanel.mcScrub.but.onPress = function():Void { // add && _root.full==false if you want a user not to be able to drag the scrub while the player is full screen if (_root.vStatusNumber != 0) { clearInterval(_root.videoInterval); _root.scrubInterval = setInterval(_root.scrubIt, 10); _root.mcVideoPlayer.mcControlPanel.mcScrub.startDrag(true, _root.startPosition, _root.mcVideoPlayer.mcControlPanel.mcScrub._y, _root.endPosition+_root.startPosition, _root.mcVideoPlayer.mcControlPanel.mcScrub._y); } }; _root.mcVideoPlayer.mcControlPanel.mcScrub.but.onRelease = _root.mcVideoPlayer.mcControlPanel.mcScrub.but.onReleaseOutside=function ():Void { // add && _root.full==false if you want a user not to be able to drag the scrub while the player is full screen if (_root.vStatusNumber != 0) { clearInterval(_root.scrubInterval); if (_root.isPaused == false) { ns.pause(); } _root.mcVideoPlayer.mcControlPanel.mcScrub.stopDrag(); _root.ns.seek(Math.floor((((_root.mcVideoPlayer.mcControlPanel.mcScrub._x-_root.startPosition)/_root.endPosition)*_root.videoDuration))); _root.videoInterval = setInterval(_root.videoStatus, 10); } }; _root.mcVideoPlayer.mcControlPanel.mcScrub.but.onReleaseOutside = _root.mcVideoPlayer.mcControlPanel.mcScrub.but.onRelease; function scrubIt():Void { if (_root.videoDuration != undefined) { _root.ns.seek(Math.floor((((_root.mcVideoPlayer.mcControlPanel.mcScrub._x-_root.startPosition)/_root.endPosition)*_root.videoDuration))); _root.ns.pause(true); _root.showTime(((_root.mcVideoPlayer.mcControlPanel.mcScrub._x-_root.startPosition)/_root.endPosition)*_root.videoDuration); _root.mcVideoPlayer.mcControlPanel.mcPlayed._x = _root.mcVideoPlayer.mcControlPanel.mcScrub._x; updateAfterEvent(); } } /******************** LINE BUTTON - when you click on the area where the scrub moves ********************/ _root.mcVideoPlayer.mcControlPanel.mcVideoLoader.butLine.onPress = function():Void { if (_root.vStatusNumber != 0) { clearInterval(_root.videoInterval); if (_root._xmouse-_root.mcVideoPlayer.mcControlPanel.mcScrub._width<_root.startPosition) { _root.mcVideoPlayer.mcControlPanel.mcScrub._x = _root.startPosition; } else if (_root._xmouse-_root.mcVideoPlayer.mcControlPanel.mcScrub._width>_root.startPosition+_root.endPosition) { _root.mcVideoPlayer.mcControlPanel.mcScrub._x = _root.startPosition+_root.endPosition; } else { _root.mcVideoPlayer.mcControlPanel.mcScrub._x = _root._xmouse; } _root.mcVideoPlayer.mcControlPanel.mcPlayed._x = _root.mcVideoPlayer.mcControlPanel.mcScrub._x; _root.ns.seek(Math.floor((((_root.mcVideoPlayer.mcControlPanel.mcScrub._x-_root.startPosition)/_root.endPosition)*_root.videoDuration))); _root.ns.pause(true); } }; _root.mcVideoPlayer.mcControlPanel.mcVideoLoader.butLine.onRelease = function():Void { if (_root.vStatusNumber != 0) { if (_root.videoDuration != undefined) { _root.ns.seek(Math.floor((((_root.mcVideoPlayer.mcControlPanel.mcScrub._x-_root.startPosition)/_root.endPosition)*_root.videoDuration))); } if (_root.isPaused == false) { ns.pause(); } _root.videoInterval = setInterval(_root.videoStatus, 10); } }; _root.mcVideoPlayer.mcControlPanel.mcVideoLoader.butLine.onReleaseOutside = _root.mcVideoPlayer.mcControlPanel.mcVideoLoader.butLine.onRelease; /******************** VIDEO FOOTAGE ********************/ var nc:NetConnection = new NetConnection(); nc.connect(null); var ns:NetStream = new NetStream(nc); ns.setBufferTime(5); ns.onStatus = function(info):Void { if (info.code == "NetStream.Buffer.Full") { _root.mcVideoPlayer.mcBuffering._visible = false; } if (info.code == "NetStream.Buffer.Empty") { _root.mcVideoPlayer.mcBuffering._visible = true; } if (info.code == "NetStream.Play.Stop") { if (_root.isPaused == false) { ns.pause(); _root.isPaused = true; } clearInterval(_root.videoInterval); _root.mcVideoPlayer.mcControlPanel.mcVideoLoader.mcMask._xscale = 0; _root.vStatusNumber = 0; _root.mcVideoPlayer.mcBuffering._visible = false; _root.mcVideoPlayer.mcControlPanel.butPause._visible = false; _root.mcVideoPlayer.mcPause.butPause._visible = false; _root.mcVideoPlayer.mcControlPanel.butPlay._visible = true; _root.mcVideoPlayer.mcPlay.butPlay._visible = true; _root.mcVideoPlayer.mcControlPanel.mcScrub._x = _root.startPosition; _root.mcVideoPlayer.mcControlPanel.mcPlayed._x = _root.mcVideoPlayer.mcControlPanel.mcScrub._x; _root.mcVideoPlayer.mcControlPanel.mcTimer.tPassedTime.htmlText = "00:00"; _root.mcVideoPlayer.mcControlPanel.mcTimer.tTotalTime.htmlText = "00:00"; ns.pause(true); if (_root.isLoaded == true) { _root.mcVideoPlayer.imageControl._alpha=100; _root.mcVideoPlayer.imageControl.fade("in", _root.speed); _root.mcBuffering._visible = false; } else { _root.loadImage(); } _root.mcVideoPlayer.myVideo._visible = false; _root.isFirst = true; } }; _root.mcVideoPlayer.myVideo._visible = false; _root.mcVideoPlayer.myVideo.attachVideo(ns); _root.mcVideoPlayer.myVideo.smoothing = true; ns["onMetaData"] = function (obj) { _root.videoDuration = obj.duration; _root.mcVideoPlayer.myVideo._visible = true; // if (_root.videoDuration != undefined) { var minutes:Number = int((int(_root.videoDuration))/60); var seconds:Number = (int(_root.videoDuration))%60; // if (minutes<10) { var m = "0"+minutes; } else { var m = minutes; } if (seconds<10) { var s = "0"+seconds; } else { var s = seconds; } if (_root.isPaused == false) { _root.mcVideoPlayer.mcControlPanel.mcTimer.tTotalTime.htmlText = m+":"+s; _root.totalMinutes = m; _root.totalSeconds = s; } } }; _root.vSound.attachAudio(ns); var backSound:Sound = new Sound(_root.vSound); _root.backSound.setVolume(100); /******************** START PLAYER ********************/ _root.setAudio(_root.volAudio); if (_root.autoStart == "false") { _root.loadImage(); } else { _root.loadVideo(); _root.mcVideoPlayer.mcPlay.butPlay._visible = false; }