0

听起来很简单吧?显然不是,因为以前对我有用过无数次的东西现在都行不通了,我也不知道为什么,我什么都试过了。这是用于 as3 的预加载器。

stop();
this.addEventListener(Event.ENTER_FRAME, loading);

function loading(e:Event):void {
    var total:Number = this.stage.loaderInfo.bytesTotal;
    var loaded:Number = this.stage.loaderInfo.bytesLoaded;

    preloader.bar_mc.gotoAndPlay(Math.floor((loaded/total)*100));

    if (total == loaded) {
        this.removeEventListener(Event.ENTER_FRAME, loading);
        preloader.playLoad.gotoAndPlay(2);
    }
}

preloader.playLoad.playButton.addEventListener(MouseEvent.CLICK, playClick);

function playClick(ev:MouseEvent):void {
    gotoAndPlay(2);
}
4

1 回答 1

1

听起来像 playButton 没有捕捉到那个事件。尝试

stage.addEventListener(MouseEvent.CLICK, playClick);

function playClick(e:MouseEvent):void {

    trace(e.target)

    if(e.target == preloader.playLoad.playButton)
    {
        gotoAndPlay(2)
    }
}

看看会抛出什么痕迹,希望它有帮助

于 2013-08-31T23:47:31.357 回答