Adobe Systems, Inc.

VideoClip.as

Go to the documentation of this file.
00001 /****************************************
00002 ** Copyright 2005-2006 Adobe Systems Incorporated
00003 ** Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt
00004 ** or a copy at http://opensource.adobe.com/licenses.html)
00005 **
00006 ** ImageClip Class 
00007 ****************************************/
00008 import mx.transitions.*;
00009 import mx.xpath.XPathAPI;
00010 import amg.*;
00011 
00012 class amg.VideoClip extends MovieClip {
00013         //private member properties
00014         
00015         private var GalleryVideoPlayer:MovieClip;
00016         private var VideoControls:MovieClip;
00017         public var strVideoPlayState:String = "paused";
00018         private var _xmlMediaNode:XMLNode;
00019         private var _strUID:String;
00020         private var _strCurrImgRendition:String;
00021         private var _strCurrMediaUrl:String;
00022         public var strThumbUrl:String;
00023         private var _strBaseRefUrl:String = "";
00024         private var _strTitle:String = "";
00025         private var _strCaption:String = "";
00026         private var _aRenditions:Array;
00027         private var _mcPhotoFile:MovieClip;
00028         private var VideoFrame:MovieClip;
00029         private var _jpegLoader:MovieClipLoader;
00030         private var _smartLoaderCallback:MovieClip;
00031         private var _bAbortFlag:Boolean = false;
00032         private var _iFrameDepth:Number = 10;
00033         private var _iPhotoDepth:Number = 1;
00034         public var iPercentLoaded:Number = 0;
00035         public var iBufferedPercent:Number
00036         public var _iBorderColor:Number = 0xffffff;
00037         private var _iBorderAlpha:Number = 100;
00038         private var _iBorderWidth:Number = 0;
00039         private var _iDropShadowWidth:Number = 0;
00040         private var _iBgColorh:Number = 0;
00041         private var _iBgAlpha:Number = 0;
00042         public var iVideoHeight:Number;
00043         public var iVideoWidth:Number;
00044         private var bManualSeek:Boolean = false;
00045         private var bTotalTimeAvailable:Boolean = false;
00046         private var txtCurrVideoTime:TextField;
00047         private var txtTotalVideoTime:TextField;
00048         private var textFmt:TextFormat;
00049         private var iVideoVolume:Number;
00050         private var bInitLoad:Boolean = true;
00051         public var iOrigCtrlWidth:Number;
00052         public var iOrigCtrlHeight:Number;
00053         public var iOrigVidWidth:Number;
00054         public var iOrigVidHeight:Number;
00055         private var _iMinVideoWidth:Number = 320;
00056 
00057         //drop shadow 
00058         public var bDropShadows:Boolean = true;
00059         private var _mcThumbBorderBottom:MovieClip;
00060         private var _mcThumbBorderRight:MovieClip;
00061         private var _mcThumbBorderCapTop:MovieClip;
00062         private var _mcThumbBorderCapL:MovieClip;
00063         private var _mcThumbBorderCapR:MovieClip;
00064         
00065         //class constructor
00066         public function VideoClip() {
00067                 this._aRenditions = new Array();
00068                 
00069                 
00070                 
00071         }
00072         
00073         public function initClip(mediaNode:XMLNode,borderWidth:Number, borderColor:Number, borderAlpha:Number,dropShadows:Boolean,bgColor:Number,bgAlpha:Number,btnForeColor:Number,btnForeAlpha:Number,btnBgColor:Number,btnBgAlpha:Number,btnBorderColor:Number,btnBorderAlpha:Number,baseRefUrl:String,p_tabIndex:Number) {
00074                 this._xmlMediaNode = mediaNode;
00075                 this._strUID = XPathAPI.selectSingleNode(mediaNode,"/item/imageId").attributes.image;
00076                 this._strTitle = XPathAPI.selectSingleNode(mediaNode,"/item/title");
00077                 this._strCaption = XPathAPI.selectSingleNode(mediaNode,"/item/description");
00078                 this._aRenditions = XPathAPI.selectNodeList(mediaNode,"/item/renditions/rendition");
00079                 this._iBorderWidth = borderWidth;
00080                 this._iBorderColor = borderColor;
00081                 this._iBorderAlpha = borderAlpha;
00082                 this.bDropShadows = dropShadows;
00083                 if(this.bDropShadows)
00084                         this._iDropShadowWidth = 4;
00085                 this._strBaseRefUrl = baseRefUrl;
00086                 
00087         
00088                 //create an empty MovieClip for the frame and image
00089                 this.VideoFrame = this.createEmptyMovieClip("frame", _iFrameDepth);
00090                 this._mcPhotoFile = this.VideoFrame.createEmptyMovieClip("photo",this.VideoFrame.getNextHighestDepth());
00091                 
00092                 for(var i:Number = 0;i<this._aRenditions.length;i++){
00093                         if(this._aRenditions[i].attributes.size == "video"){
00094                                 this._strCurrMediaUrl = this._aRenditions[i].attributes.src;
00095                         }
00096                         else if(this._aRenditions[i].attributes.size == "thumb"){
00097                                 this.strThumbUrl = this._aRenditions[i].attributes.src;
00098                         }
00099                 }
00100                 
00101                 this.GalleryVideoPlayer = this.VideoFrame.attachMovie("GalleryVideoPlayer","galleryVideoPlayer",this.VideoFrame.getNextHighestDepth(),{_visible:false});
00102                 this.GalleryVideoPlayer.autoSize = true;
00103                 this.GalleryVideoPlayer.playheadUpdateInterval = 100;
00104                 
00105                 this.GalleryVideoPlayer._x = _iBorderWidth;
00106                 this.GalleryVideoPlayer._y = _iBorderWidth;
00107                 
00108                 this.VideoControls = this.VideoFrame.attachMovie("VideoControls","videoControls",this.VideoFrame.getNextHighestDepth(),{_visible:false});
00109                 this.VideoControls.btnVideoRewind.tabIndex = p_tabIndex++;
00110                 this.VideoControls.VideoPausePlay.Play.tabIndex = p_tabIndex++;
00111                 this.VideoControls.VideoPausePlay.Pause.tabIndex = p_tabIndex++;
00112                 this.VideoControls.VideoSeekBar.VideoSeekBarThumb._visible=false;
00113         
00114                 
00115                 //VideoVolumeThumb
00116                 
00117                 this.VideoControls.VideoSeekBar.VideoSeekBarThumb.onPress = videoSeekBarThumbPress;
00118                 this.VideoControls.VideoSeekBar.VideoSeekBarThumb.onRelease = videoSeekBarThumbRelease;
00119                 this.VideoControls.VideoSeekBar.VideoSeekBarThumb.onReleaseOutside = videoSeekBarThumbRelease;
00120                 this.VideoControls.VideoVolumeControl.VideoVolumeThumb.onPress = videoVolumeThumbPress;
00121                 this.VideoControls.VideoVolumeControl.VideoVolumeThumb.onRelease = videoVolumeThumbRelease;
00122                 this.VideoControls.VideoVolumeControl.VideoVolumeThumb.onReleaseOutside = videoVolumeThumbRelease;
00123                 
00124                 this.txtCurrVideoTime = this.VideoControls.VideoSeekBar.txtCurrVideoTime;
00125                 this.txtTotalVideoTime = this.VideoControls.VideoSeekBar.txtTotalVideoTime;
00126                 
00127                 textFmt = new TextFormat();
00128                 textFmt.color = 0x575757;
00129                 textFmt.font = "Myriad Web Pro";
00130                 textFmt.size = 11;
00131                 
00132                 this.txtCurrVideoTime.text = "";
00133                 this.txtCurrVideoTime.setTextFormat(textFmt);
00134                 
00135                 this.txtTotalVideoTime.text = "";
00136                 this.txtTotalVideoTime.setTextFormat(textFmt);
00137                 
00138                 this.setTint(this.VideoControls.VideoControlsBg,bgColor,bgAlpha);
00139                 
00140                 this.setTint(this.VideoControls.VideoVolumeControl.videoVolumeSpeaker,btnForeColor,btnForeAlpha);
00141                 this.setTint(this.VideoControls.VideoVolumeControl.videoVolumeBarBg,btnBgColor,btnBgAlpha);
00142                 this.setTint(this.VideoControls.VideoVolumeControl.VideoVolumeBarOutline,btnBgColor,btnBgAlpha);
00143 
00144                 this.setTint(this.VideoControls.VideoVolumeControl.VideoVolumeThumb.videoVolumeThumbBtnFore,btnForeColor,btnForeAlpha);
00145                 this.setTint(this.VideoControls.VideoVolumeControl.VideoVolumeThumb.btnBorder,btnBorderColor,btnBorderAlpha);
00146                 this.setTint(this.VideoControls.VideoVolumeControl.VideoVolumeThumb.btnBg.fill,btnBgColor,btnBgAlpha);
00147                 
00148                 this.setTint(this.VideoControls.btnVideoRewind.btnFore,btnForeColor,btnForeAlpha);
00149                 this.setTint(this.VideoControls.btnVideoRewind.btnBorder,btnBorderColor,btnBorderAlpha);
00150                 this.setTint(this.VideoControls.btnVideoRewind.btnBg.videoRRBgFill,btnBgColor,btnBgAlpha);
00151                 this.setTint(this.VideoControls.btnVideoRewind.btnBorder,btnBorderColor,btnBorderAlpha);
00152                 
00153                 this.setTint(this.VideoControls.VideoPausePlay.Pause.btnFore,btnForeColor,btnForeAlpha);
00154                 this.setTint(this.VideoControls.VideoPausePlay.Pause.btnBorder,btnBorderColor,btnBorderAlpha);
00155                 this.setTint(this.VideoControls.VideoPausePlay.Pause.btnBg.fill,btnBgColor,btnBgAlpha);
00156 
00157                 this.setTint(this.VideoControls.VideoPausePlay.Play.btnFore,btnForeColor,btnForeAlpha);
00158                 this.setTint(this.VideoControls.VideoPausePlay.Play.btnBorder,btnBorderColor,btnBorderAlpha);
00159                 this.setTint(this.VideoControls.VideoPausePlay.Play.btnBg.fill,btnBgColor,btnBgAlpha);
00160                 
00161                 this.setTint(this.VideoControls.VideoSeekBar.VideoSeekBarThumb.seekBarThumbFore,btnForeColor,btnForeAlpha);
00162                 this.setTint(this.VideoControls.VideoSeekBar.VideoSeekBarThumb.btnBorder,btnBorderColor,btnBorderAlpha);
00163                 this.setTint(this.VideoControls.VideoSeekBar.VideoSeekBarThumb.btnBg.fill,btnBgColor,btnBgAlpha);
00164                 
00165                 this.setTint(this.VideoControls.VideoSeekBar.VideoSeekBarBg,btnBgColor,btnBgAlpha);
00166                 this.setTint(this.VideoControls.VideoSeekBar.VideoSeekBarOutline,btnBgColor,btnBgAlpha);
00167                 
00168                 textFmt.color = btnForeColor;
00169 
00170                 var listenerObject:Object = new Object();
00171                 listenerObject._parent = this;
00172                 
00173                 /***********************************
00174                 ** VIDEO RESIZE EVENT 
00175                 ** 
00176                 *************************************/
00177                 listenerObject.resize = function(eventObject:Object):Void {
00178                         
00179                         if(this._parent.GalleryVideoPlayer.totalTime == undefined){
00180                                 this._parent.VideoControls.VideoSeekBar.VideoSeekBarThumb._visible = false;
00181                                 this._parent.bTotalTimeAvailable = false;
00182                         }
00183                         else {
00184                                 this._parent.VideoControls.VideoSeekBar.VideoSeekBarThumb._visible = true;
00185                                 this._parent.bTotalTimeAvailable = true;
00186                         }
00187                         this._parent.iVideoWidth = this._parent.iOrigVidWidth = this._parent.GalleryVideoPlayer.videoWidth;
00188                         this._parent.iVideoHeight = this._parent.iOrigVidHeight = this._parent.GalleryVideoPlayer.videoHeight;
00189                         
00190                         this._parent.VideoControls._x = this._parent._iBorderWidth;
00191                         this._parent.VideoControls._y = this._parent._iBorderWidth+this._parent.iVideoHeight;
00192                         if( this._parent.iVideoWidth < this._parent._iMinVideoWidth){
00193                                 this._parent.GalleryVideoPlayer._x = this._parent._iBorderWidth + (this._parent._iMinVideoWidth/2)-(this._parent.iVideoWidth/2)
00194                                 this._parent.VideoControls.VideoControlsBg._width = this._parent._iMinVideoWidth;
00195                         }
00196                         else{
00197                                 this._parent.VideoControls.VideoControlsBg._width = this._parent.iVideoWidth;
00198                         }
00199                         
00200                         this._parent.setBorder();
00201                         this._parent.GalleryVideoPlayer._visible = true;                        
00202                         this._parent.intervalID = setInterval(this._parent,"checkTime", 500);
00203                         this._parent.iPercentLoaded = 100;
00204                         
00205                         this._parent.VideoControls.VideoSeekBar._x = (this._parent.VideoControls.VideoControlsBg._width/2) - (this._parent.VideoControls.VideoSeekBar._width/2);
00206                         this._parent.VideoControls.VideoVolumeControl._x = this._parent.VideoControls.VideoControlsBg._width - this._parent.VideoControls.VideoVolumeControl._width + 14;
00207                         
00208                         
00209                         
00210                         this._parent.VideoControls._visible = true;
00211                         this._parent.bInitLoad = false;
00212                         
00213                         
00214                 }
00215                 
00216                 /***********************************
00217                 ** VIDEO COMPLETE EVENT 
00218                 ** 
00219                 *************************************/
00220                 listenerObject.complete = function(eventObject:Object):Void {
00221                         _root.gallery.dispatchEvent("videoComplete");
00222                         this._parent.VideoControls.VideoPausePlay.Play._visible = true;
00223                 }
00224                 
00225                 this.GalleryVideoPlayer.addEventListener("resize", listenerObject);
00226                 this.GalleryVideoPlayer.addEventListener("complete", listenerObject);
00227         
00228                 //hide the clip until showImage is called
00229                 this._x = -10000;
00230                 this._y = -10000;
00231                 
00232         }
00233         
00234         private function checkTime(){
00235 
00236                 if(this.bManualSeek){
00237                         var videoSeekPercent = (this.VideoControls.VideoSeekBar.VideoSeekBarThumb._x/this.VideoControls.VideoSeekBar.VideoSeekBarThumbGuide._width);
00238                         this.GalleryVideoPlayer.seek(Math.round(videoSeekPercent*this.GalleryVideoPlayer.totalTime));
00239                         
00240                         
00241                         var strHours:String = "";
00242                         var ns_seconds:Number = (videoSeekPercent*this.GalleryVideoPlayer.totalTime);
00243                         if(ns_seconds > 3600) {
00244                                 var hours:Number = Math.floor(ns_seconds/3600);
00245                                 strHours = hours+":";
00246                                 ns_seconds -= hours*3600;
00247                         }
00248                         var minutes:Number = Math.floor(ns_seconds/60);
00249                         var seconds = Math.floor(ns_seconds%60);
00250                         if (seconds<10) 
00251                                 seconds = "0"+seconds;
00252                         //update display
00253                         this.txtCurrVideoTime.text = strHours+minutes+":"+seconds;
00254                         this.txtCurrVideoTime.setTextFormat(textFmt);
00255                 }
00256                 else {
00257                         if(this.GalleryVideoPlayer.state != "seeking"){
00258                                 //update display
00259                                 var strHours:String = "";
00260                                 var ns_seconds:Number = this.GalleryVideoPlayer.playheadTime;
00261                                 if(ns_seconds > 3600) {
00262                                         var hours:Number = Math.floor(ns_seconds/3600);
00263                                         strHours = hours+":";
00264                                         ns_seconds -= hours*3600;
00265                                         
00266                                 }
00267                                 var minutes:Number = Math.floor(ns_seconds/60);
00268                                 var seconds:Number = Math.floor(ns_seconds%60);
00269                                 if (seconds<10) 
00270                                 seconds = "0"+seconds;
00271                                 this.txtCurrVideoTime.text = strHours+minutes+":"+seconds;
00272                                 
00273                                 if(this.bTotalTimeAvailable){
00274                                         //move the thumb
00275                                         var timePercent:Number = this.GalleryVideoPlayer.playheadTime/this.GalleryVideoPlayer.totalTime;
00276                                         this.VideoControls.VideoSeekBar.VideoSeekBarThumb._x = this.VideoControls.VideoSeekBar.VideoSeekBarThumbGuide._x +(timePercent*this.VideoControls.VideoSeekBar.VideoSeekBarThumbGuide._width);
00277                                         var strHours:String = "";
00278                                         var ns_seconds:Number =  this.GalleryVideoPlayer.totalTime;
00279                                         if(ns_seconds > 3600) {
00280                                                 var hours:Number = Math.floor(ns_seconds/3600);
00281                                                 strHours = hours+":";
00282                                                 ns_seconds -= hours*3600;
00283                                                 
00284                                         }
00285                                         var minutes:Number = Math.floor(ns_seconds/60);
00286                                         var seconds:Number = Math.floor(ns_seconds%60);
00287                                         if (seconds<10) 
00288                                         seconds = "0"+seconds;
00289                                         this.txtTotalVideoTime.text = "/ "+strHours+minutes+":"+seconds;
00290                                 }
00291                                 
00292                                 
00293                                 
00294                                 this.txtCurrVideoTime.setTextFormat(textFmt);
00295                                 this.txtTotalVideoTime.setTextFormat(textFmt);
00296                         }
00297                 }
00298 
00299                 var videoVolumePercent = (this.VideoControls.VideoVolumeControl.VideoVolumeThumb._x/this.VideoControls.VideoVolumeControl.VideoVolumeThumbGuide._width);
00300                 this.iVideoVolume = Math.round(videoVolumePercent*100);
00301                 if(this.GalleryVideoPlayer.volume != this.iVideoVolume){
00302                         this.GalleryVideoPlayer.volume = this.iVideoVolume;
00303                 }
00304                 //this._parent._parent._parent.GalleryVideoPlayer.pause();
00305                 
00306                 iBufferedPercent = this.GalleryVideoPlayer.bytesLoaded/this.GalleryVideoPlayer.bytesTotal;
00307                 this.VideoControls.VideoSeekBar.VideoSeekBarBg._width = this.VideoControls.VideoSeekBar.VideoSeekBarOutline._width * iBufferedPercent;
00308         }
00309         
00310                 
00311         public function loadVideo(){
00312                 this.iPercentLoaded = 1;
00313                 this.GalleryVideoPlayer.load(this._strCurrMediaUrl);
00314         }
00315         
00316         public function abortLoad():Void {
00317                 this._bAbortFlag = true;
00318         }
00319         
00320         public function playVideo(){
00321                 this.GalleryVideoPlayer.play();
00322                 this.VideoControls.VideoPausePlay.Play._visible = false;
00323                 this.strVideoPlayState = "playing";
00324         }
00325         
00326         public function pauseVideo(){
00327                 this.GalleryVideoPlayer.pause();
00328                 this.VideoControls.VideoPausePlay.Play._visible = true;
00329                 this.strVideoPlayState = "paused";
00330         }
00331         
00332         public function rewindVideo(){
00333                 this.GalleryVideoPlayer.seek(0);
00334         }
00335         
00336         
00337         public function moveMedia(xpos:Number, ypos:Number):Void {
00338                 this._x = xpos;
00339                 this._y = ypos;
00340         }
00341         
00342         public function setHeightWidth(h:Number,w:Number,videoScaling:String):Void {
00343                 
00344                 //determine symmetrical scaling
00345                 var targetVideoWidth:Number = w - (2*this._iBorderWidth) - this._iDropShadowWidth;
00346                 var targetVideoHeight:Number = h - (2*this._iBorderWidth) - this._iDropShadowWidth - this.VideoControls._height;
00347                 
00348                 if(videoScaling == "upDown"){
00349                         //nothing
00350                 }
00351                 else if (videoScaling == "downOnly"){
00352                         if(targetVideoWidth > this.iOrigVidWidth){
00353                                 targetVideoWidth = this.iOrigVidWidth;
00354                         }
00355                                 
00356                 }
00357                 else if (videoScaling == "none"){
00358                         targetVideoWidth = this.iOrigVidWidth;
00359                         targetVideoHeight = this.iOrigVidWidth;
00360                 }
00361                 
00362                 
00363                 var heightScalar:Number = targetVideoHeight/this.GalleryVideoPlayer._height;
00364                 var widthScalar:Number = targetVideoWidth/this.GalleryVideoPlayer._width;
00365         
00366                 
00367                 if(heightScalar <= widthScalar)
00368                         var scalar:Number = heightScalar;
00369                 else
00370                         var scalar:Number = widthScalar;
00371                 
00372                 this.GalleryVideoPlayer._width = this.GalleryVideoPlayer._width*scalar;
00373                 this.GalleryVideoPlayer._height = this.GalleryVideoPlayer._height*scalar;
00374                 
00375                 this.iVideoWidth = this.GalleryVideoPlayer._width;
00376                 this.iVideoHeight = this.iOrigVidHeight = this.GalleryVideoPlayer._height;
00377                 this.VideoFrame.beginFill(0x000000, 100);
00378                 this.VideoFrame.moveTo(this._iBorderWidth,this._iBorderWidth);
00379                 this.VideoFrame.lineTo(this._iBorderWidth+this.iVideoWidth,this._iBorderWidth);
00380                 this.VideoFrame.lineTo(this._iBorderWidth+this.iVideoWidth,this._iBorderWidth+this.iVideoHeight);
00381                 this.VideoFrame.lineTo(this._iBorderWidth,this._iBorderWidth+this.iVideoHeight);
00382                 this.VideoFrame.lineTo(this._iBorderWidth,this._iBorderWidth);
00383                 this.VideoFrame.endFill();
00384                                 
00385                 this.VideoControls._x = this._iBorderWidth;
00386                 this.VideoControls._y = this._iBorderWidth+this.iVideoHeight;
00387                 
00388                 if( this.iVideoWidth < this._iMinVideoWidth){
00389                         if((this._iMinVideoWidth + (2*this._iBorderWidth) + this._iDropShadowWidth) > w)
00390                                 this.VideoControls.VideoControlsBg._width = w - (2*this._iBorderWidth) - this._iDropShadowWidth;
00391                         else
00392                                 this.VideoControls.VideoControlsBg._width = this._iMinVideoWidth;
00393                         
00394                         this.GalleryVideoPlayer._x = this._iBorderWidth + (this._iMinVideoWidth/2)-(this.iVideoWidth/2)
00395                 }
00396                 else{
00397                         this.VideoControls.VideoControlsBg._width = this.iVideoWidth;
00398                         this.GalleryVideoPlayer._x = this._iBorderWidth;
00399                 }
00400                 
00401                 this.VideoControls.VideoSeekBar._x = (this.VideoControls.VideoControlsBg._width/2) - (this.VideoControls.VideoSeekBar._width/2);
00402                 this.VideoControls.VideoVolumeControl._x = this.VideoControls.VideoControlsBg._width - this.VideoControls.VideoVolumeControl._width + 14;
00403                                 
00404                 this.setBorder();
00405                 
00406                 
00407                 
00408         }
00409         
00410         public function transitionMedia(xpos:Number, ypos:Number, transitionType:String, dir:String, dur:Number):Void {
00411                 var whichDir:Number;
00412                 //the transition direction: 0 in, 1 out
00413                 switch (dir) {
00414                 case "in" :
00415                         this._x = xpos;
00416                         this._y = ypos;
00417                         whichDir = 0;
00418                         break;
00419                 case "out" :
00420                         this.pauseVideo();
00421                         whichDir = 1;
00422                         break;
00423                 }
00424                 
00425                 switch (transitionType) {
00426                         case "blinds" :
00427                                 TransitionManager.start(this.VideoFrame, {type:mx.transitions.Blinds, direction:whichDir, duration:dur, easing:mx.transitions.easing.None.easeNone, xSections:10, ySections:10});
00428                                 break;
00429                         case "fade" :
00430                                 TransitionManager.start(this.VideoFrame, {type:mx.transitions.Fade, direction:whichDir, duration:dur, easing:mx.transitions.easing.None.easeNone, xSections:10, ySections:10});
00431                                 break;
00432                         case "fly" :
00433                                 TransitionManager.start(this.VideoFrame, {type:mx.transitions.Fly, direction:whichDir, duration:dur, easing:mx.transitions.easing.None.easeNone, xSections:10, ySections:10});
00434                                 break;
00435                         case "iris" :
00436                                 TransitionManager.start(this.VideoFrame, {type:mx.transitions.Iris, direction:whichDir, duration:dur, easing:mx.transitions.easing.None.easeNone, xSections:10, ySections:10});
00437                                 break;
00438                         case "photo" :
00439                                 TransitionManager.start(this.VideoFrame, {type:mx.transitions.Photo, direction:whichDir, duration:dur, easing:mx.transitions.easing.None.easeNone, xSections:10, ySections:10});
00440                                 break;
00441                         case "pixDissolve" :
00442                                 TransitionManager.start(this.VideoFrame, {type:mx.transitions.PixelDissolve, direction:whichDir, duration:dur, easing:mx.transitions.easing.None.easeNone, xSections:10, ySections:10});
00443                                 break;
00444                         case "rotate" :
00445                                 TransitionManager.start(this.VideoFrame, {type:mx.transitions.Rotate, direction:whichDir, duration:dur, easing:mx.transitions.easing.None.easeNone, xSections:10, ySections:10});
00446                                 break;
00447                         case "squeeze" :
00448                                 TransitionManager.start(this.VideoFrame, {type:mx.transitions.Squeeze, direction:whichDir, duration:dur, easing:mx.transitions.easing.None.easeNone, xSections:10, ySections:10});
00449                                 break;
00450                         case "wipe" :
00451                                 TransitionManager.start(this.VideoFrame, {type:mx.transitions.Wipe, direction:whichDir, duration:dur, easing:mx.transitions.easing.None.easeNone, startPoint:8});
00452                                 break;
00453                         case "zoom" :
00454                                 TransitionManager.start(this.VideoFrame, {type:mx.transitions.Zoom, direction:whichDir, duration:dur, easing:mx.transitions.easing.None.easeNone, xSections:10, ySections:10});
00455                                 break;
00456                         case "keyhole" :
00457                                 TransitionManager.start(this.VideoFrame, {type:amg.transitions.KeyHole, direction:whichDir, duration:dur, easing:mx.transitions.easing.None.easeNone, xSections:10, ySections:10});
00458                                 break;
00459                         case "cut" :
00460                                 if(dir == "out")
00461                                         this._x = -10000;
00462                                 break;
00463                 }
00464         }
00465                 //function to draw colored border around thumbnail
00466         public function setBorder():Void {
00467                 this.VideoFrame.clear();
00468                 
00469                 this._mcThumbBorderCapTop = this.VideoFrame.attachMovie("mcThumbBorderCapTop","topcap",15);
00470                 this._mcThumbBorderRight = this.VideoFrame.attachMovie("mcThumbBorderRight","right_border",14);
00471                 this._mcThumbBorderBottom = this.VideoFrame.attachMovie("mcThumbBorderBottom","bot_border",13);
00472                 this._mcThumbBorderCapL = this.VideoFrame.attachMovie("mcThumbBorderCapL","leftcap",12);
00473                 this._mcThumbBorderCapR = this.VideoFrame.attachMovie("mcThumbBorderCapR","rightcap",11);
00474                 
00475                 
00476                 this.VideoFrame.beginFill(0x000000,100);
00477                 this.VideoFrame.moveTo(this._iBorderWidth,this._iBorderWidth);
00478                 this.VideoFrame.lineTo(this._iBorderWidth+this.VideoControls._width,this._iBorderWidth);
00479                 this.VideoFrame.lineTo(this._iBorderWidth+this.VideoControls._width,this._iBorderWidth+this.iVideoHeight);
00480                 this.VideoFrame.lineTo(this._iBorderWidth,this._iBorderWidth+this.iVideoHeight);
00481                 this.VideoFrame.lineTo(this._iBorderWidth,this._iBorderWidth);
00482                 this.VideoFrame.endFill();
00483                 
00484                 
00485                 //draw a top border around video
00486                 this.VideoFrame.beginFill(this._iBorderColor, _iBorderAlpha);
00487                 this.VideoFrame.moveTo(this.VideoControls._x-this._iBorderWidth, this.GalleryVideoPlayer._y);
00488                 this.VideoFrame.lineTo(this.VideoControls._x+this.VideoControls._width+this._iBorderWidth, this.GalleryVideoPlayer._y);
00489                 this.VideoFrame.lineTo(this.VideoControls._x+this.VideoControls._width+this._iBorderWidth, this.GalleryVideoPlayer._y-this._iBorderWidth);
00490                 this.VideoFrame.lineTo(this.VideoControls._x-this._iBorderWidth, this.GalleryVideoPlayer._y-this._iBorderWidth);
00491                 this.VideoFrame.lineTo(this.VideoControls._x-this._iBorderWidth, this.GalleryVideoPlayer._y);
00492                 this.VideoFrame.endFill();
00493                 //bottom border
00494                 this.VideoFrame.beginFill(this._iBorderColor, _iBorderAlpha);
00495                 this.VideoFrame.moveTo(this.VideoControls._x-this._iBorderWidth, this.GalleryVideoPlayer._y+this.GalleryVideoPlayer._height+this.VideoControls._height);
00496                 this.VideoFrame.lineTo(this.VideoControls._x+this.VideoControls._width+this._iBorderWidth, this.GalleryVideoPlayer._y+this.GalleryVideoPlayer._height+this.VideoControls._height);
00497                 this.VideoFrame.lineTo(this.VideoControls._x+this.VideoControls._width+this._iBorderWidth, this.GalleryVideoPlayer._y+this.GalleryVideoPlayer._height+this.VideoControls._height+this._iBorderWidth);
00498                 this.VideoFrame.lineTo(this.VideoControls._x-this._iBorderWidth, this.GalleryVideoPlayer._y+this.GalleryVideoPlayer._height+this.VideoControls._height+this._iBorderWidth);
00499                 this.VideoFrame.lineTo(this.VideoControls._x-this._iBorderWidth, this.GalleryVideoPlayer._y+this.GalleryVideoPlayer._height+this.VideoControls._height);
00500                 this.VideoFrame.endFill();
00501                 
00502                 //right border
00503                 this.VideoFrame.beginFill(this._iBorderColor, _iBorderAlpha);
00504                 this.VideoFrame.moveTo(this.VideoControls._x+this.VideoControls._width, this.GalleryVideoPlayer._y);
00505                 this.VideoFrame.lineTo(this.VideoControls._x+this.VideoControls._width+this._iBorderWidth, this.GalleryVideoPlayer._y);
00506                 this.VideoFrame.lineTo(this.VideoControls._x+this.VideoControls._width+this._iBorderWidth, this.GalleryVideoPlayer._y+this.GalleryVideoPlayer._height+this.VideoControls._height);
00507                 this.VideoFrame.lineTo(this.VideoControls._x+this.VideoControls._width, this.GalleryVideoPlayer._y+this.GalleryVideoPlayer._height+this.VideoControls._height);
00508                 this.VideoFrame.lineTo(this.VideoControls._x+this.VideoControls._width, this.GalleryVideoPlayer._y);
00509                 this.VideoFrame.endFill();
00510                 
00511                 //left border
00512                 this.VideoFrame.beginFill(this._iBorderColor, _iBorderAlpha);
00513                 this.VideoFrame.moveTo(this.VideoControls._x-this._iBorderWidth, this.GalleryVideoPlayer._y);
00514                 this.VideoFrame.lineTo(this.VideoControls._x, this.GalleryVideoPlayer._y);
00515                 this.VideoFrame.lineTo(this.VideoControls._x, this.GalleryVideoPlayer._y+this.GalleryVideoPlayer._height+this.VideoControls._height);
00516                 this.VideoFrame.lineTo(this.VideoControls._x-this._iBorderWidth, this.GalleryVideoPlayer._y+this.GalleryVideoPlayer._height+this.VideoControls._height);
00517                 this.VideoFrame.lineTo(this.VideoControls._x-this._iBorderWidth, this.GalleryVideoPlayer._y);
00518                 this.VideoFrame.endFill();
00519         
00520                 //ActionScript DropShadows slow down rendering too much so we are going with movieclip approach
00521                 //[distance:Number], [angle:Number], [color:Number], [alpha:Number], [blurX:Number], [blurY:Number], [strength:Number], [quality:Number], [inner:Boolean], [knockout:Boolean], [hideObject:Boolean]
00522                 //var dropShadow:DropShadowFilter = new DropShadowFilter(5, 45, 0x000000, 0.5, 5, 5, 1, 3); 
00523                 //this.VideoFrame.filters = [dropShadow];
00524                 if(bDropShadows){
00525                         this._mcThumbBorderCapTop._visible = true;
00526                         this._mcThumbBorderRight._visible = true;
00527                         this._mcThumbBorderBottom._visible = true;
00528                         this._mcThumbBorderCapL._visible = true;
00529                         this._mcThumbBorderCapR._visible = true;
00530                         //set bottom dropshadow 
00531                         var tWidth:Number = this.VideoControls._width+(2*this._iBorderWidth);
00532                         this._mcThumbBorderCapL._x = this.VideoControls._x-this._iBorderWidth;
00533                         this._mcThumbBorderBottom._x = this._mcThumbBorderCapL._x + this._mcThumbBorderCapL._width;
00534                         this._mcThumbBorderBottom._y = this._mcThumbBorderCapL._y = this._mcThumbBorderCapR._y = this.VideoControls._y+this._iBorderWidth+this.VideoControls._height;
00535                         this._mcThumbBorderBottom._width = tWidth - this._mcThumbBorderCapL._width;
00536                         this._mcThumbBorderCapR._x = this._mcThumbBorderBottom._x + this._mcThumbBorderBottom._width;
00537                         
00538                         //right dropshadow
00539                         this._mcThumbBorderCapTop._x = this._mcThumbBorderRight._x = this.VideoControls._x+this.VideoControls._width+this._iBorderWidth;
00540                         this._mcThumbBorderCapTop._y = this.GalleryVideoPlayer._y - this._iBorderWidth;
00541                         this._mcThumbBorderRight._y = this.GalleryVideoPlayer._y - this._iBorderWidth + this._mcThumbBorderCapTop._height;
00542                         this._mcThumbBorderRight._height = this.GalleryVideoPlayer._height + (this._iBorderWidth*2) - this._mcThumbBorderCapR._height+this.VideoControls._height;
00543                 }
00544                 else {
00545                         this._mcThumbBorderCapTop._visible = false;
00546                         this._mcThumbBorderRight._visible = false;
00547                         this._mcThumbBorderBottom._visible = false;
00548                         this._mcThumbBorderCapL._visible = false;
00549                         this._mcThumbBorderCapR._visible = false;
00550                 }
00551 
00552         }
00553 
00554         
00555         public function videoSeekBarThumbPress(){
00556                 this._parent._parent._parent._parent.bManualSeek = true;
00557                 this._parent._parent._parent._parent.GalleryVideoPlayer.pause();
00558                 
00559                 var dragExtent:Number = (this._parent._parent.VideoSeekBar.VideoSeekBarThumbGuide._width+this._parent._parent.VideoSeekBar.VideoSeekBarThumbGuide._x)*this._parent._parent._parent._parent.iBufferedPercent;
00560                 startDrag(this,false,this._parent._parent.VideoSeekBar.VideoSeekBarThumbGuide._x,-5.5,dragExtent,-5.5);
00561         }
00562         public function videoSeekBarThumbRelease(){
00563                 
00564                 
00565                 var videoSeekPercent = (this._parent._parent.VideoSeekBar.VideoSeekBarThumb._x/this._parent._parent.VideoSeekBar.VideoSeekBarThumbGuide._width);
00566                 this._parent._parent._parent._parent.GalleryVideoPlayer.seek(videoSeekPercent*this._parent._parent._parent._parent.GalleryVideoPlayer.totalTime);
00567 
00568                 if(this._parent._parent._parent._parent.strVideoPlayState == "paused")
00569                         this._parent._parent._parent._parent.GalleryVideoPlayer.pause();
00570                 else
00571                         this._parent._parent._parent._parent.GalleryVideoPlayer.play();
00572                 stopDrag();
00573                 this._parent._parent._parent._parent.bManualSeek = false;
00574         }
00575         
00576         public function videoVolumeThumbPress(){
00577                 startDrag(this,false,this._parent.VideoVolumeThumbGuide._x,this._y,this._parent.VideoVolumeThumbGuide._width+this._parent.VideoVolumeThumbGuide._x,this._y);
00578         }
00579         public function videoVolumeThumbRelease(){
00580                 stopDrag();
00581         }
00582         
00583         public function livePreview(whichPart:String, styleNode:XMLNode):Void {
00584                 //this is a stubbed in function -the work order does not call for previewing video styles
00585                 switch (whichPart){
00586                         case "videoCtrlBgColor":
00587                                 //this.setTint(this.VideoControls.VideoControlsBg,parseInt("0x"+styleNode.attributes.color),parseInt(styleNode.attributes.alpha));
00588                                 break;
00589                         case "videoCtrlBgColor":
00590                                 
00591                                 break;
00592                         case "videoCtrlBtnBorder":
00593                                 
00594                                 break;
00595                         case "videoCtrlBtnBackground":
00596                                 
00597                                 break;
00598                         case "videoCtrlBtnFore":
00599                                 
00600                                 break;
00601                         case "videoDropShadow":
00602                                 
00603                                 break;
00604                 }
00605                 
00606         }
00607         
00608         /**************************************************************
00609         ** setTint
00610         ** Sets a color object for a movieclip and then sets its tint
00611         ** allowing for ActionScript control of display colors
00612         ****************************************************************/
00613         function setTint(clip:MovieClip, colorVal:Number, alphaVal:Number):Void {
00614                 
00615                 var color:Color = new Color(clip);
00616                 var oColorTransform:Object = new Object();
00617                 oColorTransform.ra = oColorTransform.ga=oColorTransform.ba=0;
00618                 oColorTransform.rb = (colorVal >> 16) & 0xFF;
00619                 oColorTransform.gb = (colorVal >> 8) & 0xFF;
00620                 oColorTransform.bb = colorVal & 0xFF;
00621                 oColorTransform.ab = ((alphaVal/100)*255)-255;
00622                 color.setTransform(oColorTransform);
00623         }
00624         
00625         
00626         //accessors
00627         public function get x():Number {
00628                 return this.VideoFrame._x;
00629         }
00630         public function set x(newxpos:Number):Void {
00631                 this.VideoFrame._x = newxpos;
00632         }
00633         public function get y():Number {
00634                 return this.VideoFrame._y;
00635         }
00636         public function set y(newypos:Number):Void {
00637                 this.VideoFrame._y = newypos;
00638         }
00639         public function get width():Number {
00640                 return this._width;
00641         }
00642         public function get height():Number {
00643                 return this._height;
00644         }
00645 }

Copyright © 2006 Adobe Systems Incorporated.

Use of this website signifies your agreement to the Terms of Use and Online Privacy Policy.