如何最好地触发影片剪辑中的功能

时间:2014-01-04 19:09:15

标签: actionscript-3 flash function

我想要触发一个位于Movie Clip中的函数

my_mc.addEventListener(MouseEvent.CLICK,myfuntion);

    function myfuntion(myEvent:MouseEvent):void
    {
        MovieClip(this.root).gotoAndStop(44);
        tvscreen_mc.function("byby");

    }

byby功能位于tvscreen_mc

function byby(myEvent:MouseEvent):void {        
my_player.destroy();    

 }

1 个答案:

答案 0 :(得分:1)

替换

my_mc.addEventListener(MouseEvent.CLICK,myfuntion);

    function myfuntion(myEvent:MouseEvent):void
    {
        MovieClip(this.root).gotoAndStop(44);
        tvscreen_mc.function("byby");

    }

MovieClip(root).my_mc.addEventListener(MouseEvent.CLICK, MovieClip(root).tvscreen_mc.byby);

如果你处于根级别(我假设你是这样,但是你把它放在其他地方),这也会有效:

my_mc.addEventListener(MouseEvent.CLICK, tvscreen_mc.byby);