Flash Video Player:过渡控制放置

时间:2021-09-11 19:00:10

I'm customizing a video player (http://23video.com), and I'd like the controls to transition off screen after the mouse is stationary or outside of the player. At the moment, they instantly pop off screen. Here's the function that moves the controls:

我正在定制一个视频播放器(http://23video.com),我希望控制器在鼠标静止后或播放器外转换屏幕。此刻,他们立即弹出屏幕。这是移动控件的功能:

private function trayHide():void {
    if (showPlayList) return;
    trayTimer.stop();
    if(props.getNumber('trayTimeout')<=0) return;
    tray.y = FlexGlobals.topLevelApplication.height - 74;
    tray.visible = true;
}            

Is there something I can put in place of the "tray.y = FlexGlobals.topLevelApplication.height - 74;" to get it to transition the height change over a second or two?

有什么我可以代替“tray.y = FlexGlobals.topLevelApplication.height - 74;”让它过渡高度变化超过一两秒?

PS: The video player that I'm basing this off of is at https://github.com/23/videoplayer.

PS:我所依据的视频播放器是https://github.com/23/videoplayer。

1 个解决方案

#1


1  

(First, I wrote the code for the 23 Video player; and would like to apologize for the confusion of the tray.y line. It's a weird kind of hard-code.)

(首先,我为23视频播放器编写了代码;并且想为tray.y行的混乱道歉。这是一种奇怪的硬编码。)

You can achieve the animation through mx.effects.Move

您可以通过mx.effects.Move实现动画

Add this somewhere in the code:

在代码中的某处添加:

import mx.effects.Move;

And this somewhere else:

而这在其他地方:

<mx:Move id="moveEffect" target="{tray}" duration="500" />

With these in place you can substitute the tray.y line for:

有了这些,您可以替换tray.y行:

moveEffect.end();
moveEffect.yTo = FlexGlobals.topLevelApplication.height - 74;
moveEffect.play();

In addition to this simple trick, you will need to have placed the tray correctly beforehand; and to make sure it's visible while being animated.

除了这个简单的技巧,你需要事先正确放置托盘;并确保它在动画时可见。

#1


1  

(First, I wrote the code for the 23 Video player; and would like to apologize for the confusion of the tray.y line. It's a weird kind of hard-code.)

(首先,我为23视频播放器编写了代码;并且想为tray.y行的混乱道歉。这是一种奇怪的硬编码。)

You can achieve the animation through mx.effects.Move

您可以通过mx.effects.Move实现动画

Add this somewhere in the code:

在代码中的某处添加:

import mx.effects.Move;

And this somewhere else:

而这在其他地方:

<mx:Move id="moveEffect" target="{tray}" duration="500" />

With these in place you can substitute the tray.y line for:

有了这些,您可以替换tray.y行:

moveEffect.end();
moveEffect.yTo = FlexGlobals.topLevelApplication.height - 74;
moveEffect.play();

In addition to this simple trick, you will need to have placed the tray correctly beforehand; and to make sure it's visible while being animated.

除了这个简单的技巧,你需要事先正确放置托盘;并确保它在动画时可见。