在Flash中同时启动视频并播放影片剪辑
问题描述:
是否有可能(在AS2或AS3中)有一个按钮同时启动视频和MC?在Flash中同时启动视频并播放影片剪辑
这个想法是,视频将与视频对话框中包含动画引用的动画片段一起播放,因此同步将至关重要。
答
AS3。
我认为你已经有一个videoPlayer或一些netstream和元数据处理程序。并且你在舞台上拥有所有需要的物品。
var playProgressTimer:Timer;
var movieClip:MovieClip;
function handlePlayButtonClicked (e : MouseEvent) : void
{
playProgressTimer = new Timer(100);
playProgressTimer.addEventListener(TimerEvent.TIMER, onPlayProgressTick);
playProgressTimer.start();
}
function onPlayProgressTick (e : TimerEvent) : void
{
if (!netStream || !metaData)
return;
// getting the progress of the video
var _playProgress:Number = netStream.time/metaData.duration;
// setting the same progress to the movieclip you have.
movieClip.gotoAndStop(int(_playProgress * movieClip.totalFrames));
}
非常感谢! –
不客气! –