0

我有一个问题,我无法弄清楚我正在通过代码寻找几个小时我已经在 Flash 中创建了一个网站,但它不会转到第 4 页 de 页面填充就像其他人一样,代码完全相同我添加了greenshock lite tween。但是当我播放电影时,第 4 页只是没有打开。

我唯一得到的是

TypeError:错误 #1009:无法访问空对象引用的属性或方法。在 Tommorowland_Scene1_fla::MainTimeline/frame1()[Tommorowland_Scene1_fla.MainTimeline::frame1:25]

next_btn.addEventListener(MouseEvent.CLICK, nextImage);

那是我的滑块不再工作的另一件事没有改变任何事情所以我不知道 greenshock litetween 是否搞砸了一些东西但它很烦人 #!$@

        import flash.events.MouseEvent;
    import com.greensock.*;
    stop();


    button1.addEventListener(MouseEvent.CLICK, button1_clicked);
    function button1_clicked(e:MouseEvent):void{
            TweenLite.to(balk_mc, 1, {x:141, y:balk_mc.y});
            gotoAndStop("page1");
    }

    button2.addEventListener(MouseEvent.CLICK, button2_clicked);
    function button2_clicked(e:MouseEvent):void{
            TweenLite.to(balk_mc, 1, {x:330, y:balk_mc.y});
            gotoAndStop("page2");
    }

    button3.addEventListener(MouseEvent.CLICK, button3_clicked);
    function button3_clicked(e:MouseEvent):void{
            TweenLite.to(balk_mc, 1, {x:551, y:balk_mc.y});
            gotoAndStop("page3");
    }
            var number:Number = 1;

    next_btn.addEventListener(MouseEvent.CLICK, nextImage);

    checkNumber();
    function nextImage(event:MouseEvent):void {
        //trace("next button geklikt!");
        number++;
        loader.source = "images/tommorrowland"+number+".png";
        checkNumber();
    }

    previous_btn.addEventListener(MouseEvent.CLICK, previousImage);

    function previousImage(event:MouseEvent):void {
        //trace("previous button geklikt!");
        number--;
        loader.source = "images/tommorrowland"+number+".png";
        checkNumber();
    }

    function checkNumber():void {
        next_btn.visible = true;
        previous_btn.visible = true;
        if(number == 4){
            next_btn.visible = false;
        }
        if(number == 1){
            previous_btn.visible = false;
        }
    }

    button4.addEventListener(MouseEvent.CLICK, button4_clicked);
    function button4_clicked(e:MouseEvent):void{
            TweenLite.to(balk_mc, 1, {x:735, y:balk_mc.y});
            gotoAndStop("page4");
    }

我希望有一个人可以帮助我。

4

1 回答 1

0

如果这是产生错误的行:

next_btn.addEventListener(MouseEvent.CLICK, nextImage);

然后next_btn在您尝试在其上设置鼠标事件的时间线上不存在。确保在添加mouseEvent侦听器之前创建了 next_btn 或存在。

于 2013-10-09T17:35:12.247 回答