在as3上单击我有2个按钮A和B,当用户点击按钮电影正在播放时,在MovieClip中,现在我想要当用户点击按钮时电影应该播放 当它到达第59帧时,运行getURL(abcd.html),如果用户点击按钮B它到达fram 59并且getURL(xyz.html)两个URL都不同
答案 0 :(得分:0)
on enter frame检查movieclipA.currentFrame是否为59执行代码并为movieclipB执行相同操作
答案 1 :(得分:0)
创建一个变量来保存单击按钮的结果。有点像...
int buttonClicked = -1;
// assuming the movie clip is called 'moviePlayerMovieClip'
moviePlayerMovieClip.stop();
然后在你的按钮上设置所述变量的值,如
moviePlayerMovieClip.button1.addEventListener(MouseEvent.CLICK, onButtonClicked);
moviePlayerMovieClip.button2.addEventListener(MouseEvent.CLICK, onButtonClicked);
function onButtonClicked(event:MouseEvent):void {
if(event.target == moviePlayerMovieClip.button1)
{
buttonClicked = 1;
}
else
{
buttonClicked = 2;
}
// let the movie clip play
moviePlayerMovieClip.play();
}
影片片段应该有一个输入帧处理程序,类似于......
moviePlayerMovieClip.addEventListener(Event.ENTER_FRAME,onEnterFrame);
function onEnterFrame(event:Event) {
if(moviePlayerMovieClip.currentFrame == 59)
{
if(buttonClicked == 1)
{
flash.net.navigateToURL('abcd.html', "_self");
}
else if(buttonClicked == 2)
{
flash.net.navigateToURL('xyz.html', "_self");
}
}
}