Flash as3.0用按钮控制播放

play_btn.addEventListener(MouseEvent.CLICK,play);

function fl_ClickToGoToAndPlayFromFrame(event:MouseEvent):void
{
gotoAndPlay(5);
}

输出
TypeError: Error #1006: addEventListener 不是函数。
at CH_fla::MainTimeline/frame149()

adobe flash cs6

第1个回答  2013-12-11
首先确认你那个play_btn是否是可交互的,影片剪辑或者按钮类型的。然后,play是当前帧所属的影片剪辑的方法,不接收参数,addEventListener方法接收的函数必须能传进一个类型为Event的参数,因此你大概可以这样
play_btn.addEventListener(MouseEvent.CLICK,playThis);
function playThis(e:MouseEvent):void
{
play();
//其它操作
}
第2个回答  推荐于2016-09-01
play_btn.addEventListener(MouseEvent.CLICK,play);

function fl_ClickToGoToAndPlayFromFrame(event:MouseEvent):void
{
gotoAndPlay(5);
}

改成:
play_btn.addEventListener(MouseEvent.CLICK,player);

function player(event:MouseEvent):void
{
gotoAndPlay(5);
}追问

TypeError: Error #1006: addEventListener 不是函数。
at CH_fla::MainTimeline/frame149()

还是不成

追答

具体问题需要看原文件才能明白。这代码我在我的机子上运行没有任何问题。

本回答被提问者和网友采纳
相似回答