Investigation of CircleCube Video Player (Day 7)
来源:互联网 发布:沈阳i5数控编程方法 编辑:程序博客网 时间:2024/04/29 10:22
Now we are at point where to add a function: when the player is in playing state, then start the timer, to hide the control panel.
version b.4
For now, the logic is: if the cursor is outside the vcr area, then mouseStill will increase, and until it reaches mouseStillMax(=3), then the vcr hides. And this Timer will be triggered in showVCR(), but now it is commented. And we will trigger it when play|pause the video, so change the playDown() to:
public function playDown($e:MouseEvent=null):void{...switch ($cs) {case "ready":{...mouseStill = 0;mouseTimer.start();break;}case "playing":{...mouseStill = 0;mouseTimer.stop();break;}case "paused":{...mouseStill = 0;mouseTimer.start();break;}case "complete":{...mouseStill = 0;mouseTimer.start();break;}default:{trace("ERROR: " + currentStatus);}}return;}
And add hidePlayOverlay() call into mouseStatus() to hideplayOverlay together:
public function mouseStatus($e:TimerEvent):void{if (mouseY < vcr.y || mouseY > vcr.height + vcr.y) {mouseStill++;}if (mouseStill > mouseStillMax) {mouseStill = 0;hideVCR();hidePlayOverlay();}return;}
And, we should remember we have not updated videoComplete(), we should show vcr and playOverlay when video finished, and clear the timer that would hide them:
public function videoComplete():void{ns.pause();videoTimer.stop();currentStatus = "complete";vcr.bar.bg.width = 0;vcr.bar.loadbar.width = 0;vcr.bar.playbar.width = 0;vcr.bar.scrub.x = 0;playOverlay.icon.gotoAndStop("playing");showPlayOverlay();showVCR();mouseStill = 0; mouseTimer.stop();clearVideoStatus();vid.setChildIndex(video, vid.numChildren - 2);return;}
Now, talk about the condition that increase mouseStill, it is reasonable to keep the current logic, because you may operate on theVCR, then it should not disappear.
But you may notice that the delay of hiding vcr is not even, we need reset mouseStill to 0 when togglevcr to show:
public function toggleVCR($e:MouseEvent=null):void{if (vcr.timeCurrent.timeDisplay.visible){hideVCR();hidePlayOverlay();}else{showVCR();showPlayOverlay();mouseStill = 0;}}
And, for securing the operation, we should unlock the control after it shows 100%, so change showVCR():
public function showVCR($e:MouseEvent=null):void{if (!vcr.timeCurrent.timeDisplay.visible) {vcr.mouseChildren = true;com.greensock.TweenNano.to(vcr, 0.4, {"alpha":fadeInAlpha, "ease":com.greensock.easing.Quad.easeOut} ); vcr.timeCurrent.timeDisplay.visible = true;vcr.timeTotal.timeDisplay.visible = true;}return;}
to:
public function showVCR($e:MouseEvent=null):void{if (!vcr.timeCurrent.timeDisplay.visible) {com.greensock.TweenNano.to(vcr, 0.4, {"alpha":fadeInAlpha, "ease":com.greensock.easing.Quad.easeOut,"onComplete": function(){vcr.mouseChildren = true;}} ); vcr.timeCurrent.timeDisplay.visible = true;vcr.timeTotal.timeDisplay.visible = true;}return;}
change showPlayOverlay():
public function showPlayOverlay():void{playOverlay.mouseEnabled = true;com.greensock.TweenNano.to(playOverlay, 0.2, {"alpha":0.75, "scaleX":playOverlay.sXY, "scaleY":playOverlay.sXY, "ease":com.greensock.easing.Back.easeOut, "overwrite":false} );return;}
to:
public function showPlayOverlay():void{com.greensock.TweenNano.to(playOverlay, 0.2, {"alpha":0.75, "scaleX":playOverlay.sXY, "scaleY":playOverlay.sXY, "ease":com.greensock.easing.Back.easeOut, "onComplete": function(){playOverlay.mouseEnabled = true;},"overwrite":false} );return;}
Inside onMetaData() and onXMPData(), replace call to playerLayout(), with videoLayout().
public function onMetaData($obj:Object):void{if (duration == -1 || !pl_duration) {duration = Number($obj["duration"]);trace("onMetaData duration:", duration);pl_duration = true;videoLayout();}return;}public function onXMPData($obj:Object):void{if (duration == -1 || !pl_duration) {duration = Number($obj["duration"]);trace("onXMPdata duration:", duration);pl_duration = true;videoLayout();}return;}
and remove playerLayout(), since it just callvideoLayout():
public function playerLayout():void{videoLayout();return;}
- Investigation of CircleCube Video Player (Day 7)
- Investigation of CircleCube Video Player (Day 1)
- Investigation of CircleCube Video Player (Day 2)
- Investigation of CircleCube Video Player (Day 3)
- Investigation of CircleCube Video Player (Day 4)
- Investigation of CircleCube Video Player (Day 5)
- Investigation of CircleCube Video Player (Day 6)
- Quick Conclusion about CircleCube Video Player
- From pruned CircleCube Video Player to e-Notice module - Movie Gallery Player
- the archtechture of flash video player
- Actionscript 2.0 Flash "HD VIDEO" - Investigation
- HTML5 Video Player
- Open Video Player (OVP)
- Adobe 0day video
- jobdu 7 Day of Week
- 题目7:Day of Week
- Investigation of Why InetAddress.isReachable() Returning false
- Investigation on performance of data load
- Photoshop 保存PNG格式交错和不交错有差别
- 让Google Market帮你定位渠道来源
- java中如何弹出子对话框,使得点击其他区域无效
- 身份证验证方法
- 如何在Oracle中使用Java存储过程(详解)
- Investigation of CircleCube Video Player (Day 7)
- 在sqlplus中根据需要调用不同的脚本
- OAF MVC Architecture
- C#实现M选N的全排列的问题的方法
- Windows 8 各个版本区别对比,选择哪个版本最好最适合自己
- XNA Game Engine教程系列2- Engine, Content和Services
- HAO3GP整站源码学生当时就蒙了
- MySQL将一个数据库中的表移到另一个数据库中
- 享元模式(FlyWeight)个人认为是局部单例模式的意思