0

我正在尝试构建一个条件语句,该语句将在不同的 Timer Delay 时 addChild 和 removeChild。在我走得更远之前,我想,我应该提一下,我正在使用 TweenMax 来缓和缓和 Child 的 alpha 从 1 到 0 并在模拟淡入/淡出的过程中返回。

我只遇到一行问题 - 在条件语句中。它运行“正常”。电影按我想要的方式运行,但是删除/添加子转换的速度不是我想要的速度。我在输出中收到一条错误消息,但除此之外,电影运行良好。

请注意,我还是 AS3 的新手。我的脚本重复且冗长。对不起!我已经评论了错误所在的位置。先谢谢了!!

stop();

import com.greensock.*;
import com.greensock.easing.*;
import com.greensock.plugins.*;

var removeKid:Timer=new Timer(1000,1);
var defaultPage:Timer=new Timer(2500,1);


stage.scaleMode=StageScaleMode.NO_SCALE;
stage.displayState="fullScreen";


//Panel Drop Shadow ====================================
TweenMax.to(main_mc, 0, {dropShadowFilter:{color:0x000000, alpha:0.3, blurX:12, blurY:9, distance:7}});
TweenMax.to(sub_mc, 0, {dropShadowFilter:{color:0x000000, alpha:0.3, blurX:12, blurY:9, distance:7}});
TweenMax.to(loader_mc.panel20_mc, 0, {dropShadowFilter:{color:0x000000, alpha:0.3, blurX:12, blurY:9, distance:7}});
TweenMax.to(loader_mc.panel40_mc, 0, {dropShadowFilter:{color:0x000000, alpha:0.3, blurX:12, blurY:9, distance:7}});
TweenMax.to(loader_mc.panel60_mc, 0, {dropShadowFilter:{color:0x000000, alpha:0.3, blurX:12, blurY:9, distance:7}});
TweenMax.to(loader_mc.panel80_mc, 0, {dropShadowFilter:{color:0x000000, alpha:0.3, blurX:12, blurY:9, distance:7}});
//Panel Drop Shadow ====================================

scroll3_mc.alpha=0;
scroll3_mc.visible;

scroll2_mc.alpha=0;
scroll2_mc.visible=false;

scroll_mc.visible=false;
scroll_mc.alpha=0;
//Hidden Panels for opening sequence =====================

//Open Panels ==========================================
TweenMax.to(loader_mc.panel20_mc, 1, {x:340, visible:0, ease:Quint.easeInOut});
TweenMax.to(loader_mc.panel20_mc, 1, {delay:0.2, x:170, visible:0, ease:Quint.easeInOut});
TweenMax.to(loader_mc.panel40_mc, 1, {delay:0.2, x:170, visible:0, ease:Quint.easeInOut});
TweenMax.to(loader_mc.panel20_mc, 1, {delay:0.4, x:0, visible:0, ease:Quint.easeInOut});
TweenMax.to(loader_mc.panel40_mc, 1, {delay:0.4, x:0, visible:0, ease:Quint.easeInOut});
TweenMax.to(loader_mc.panel60_mc, 1, {delay:0.4, x:0, visible:0, ease:Quint.easeInOut});
TweenMax.to(loader_mc.panel20_mc, 1, {delay:0.6, x:-170, visible:0, ease:Quint.easeInOut});
TweenMax.to(loader_mc.panel40_mc, 1, {delay:0.6, x:-170, visible:0, ease:Quint.easeInOut});
TweenMax.to(loader_mc.panel60_mc, 1, {delay:0.6, x:-170, visible:0, ease:Quint.easeInOut});
TweenMax.to(loader_mc.panel80_mc, 1, {delay:0.6, x:-170, visible:0, ease:Quint.easeInOut});
TweenMax.to(loader_mc, 0, {delay:1.4, visible:0});
//Open Panels ==========================================

//SWF swapping =========================================
this.addEventListener(MouseEvent.CLICK, clickListener8);

var oldSection=null;

// sectionLoadedListener =======================================================================

//Main Content area =====================================
exit_mc.alpha=0;
exit_mc.buttonMode=true;


function clickListener8(evt:Event) {

    // test for nav links -----------------------------

    if (evt.target.name=="wc1_btn") {
        loadSection("WC.swf");
    } else if (evt.target.name == "ba1_btn") {
        loadSection("BA_1.swf");
    } else if (evt.target.name == "ba2_btn") {
        loadSection("BA_2.swf");
    } else if (evt.target.name == "ba3_btn") {
        loadSection("BA_3.swf");
    } else if (evt.target.name == "ba4_btn") {
        loadSection("BA_4.swf");
    } else if (evt.target.name == "ba5_btn") {
        loadSection("BA_5.swf");
    } else if (evt.target.name == "ba6_btn") {
        loadSection("BA_6.swf");
    } else if (evt.target.name == "ba7_btn") {
        loadSection("BA_7.swf");
    } else if (evt.target.name == "ba8_btn") {
        loadSection("BA_8.swf");
    } else if (evt.target.name == "windowClings_btn") {
        loadSection("loaded.swf");
    } else if (evt.target.name == "bannerAds_btn") {
        loadSection("BA_1.swf");
    }
}

function loadSection(filePath:String) {
    var url:URLRequest=new URLRequest(filePath);

    var ldr:Loader = new Loader();
    ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, sectionLoadedListener);
    ldr.load(url);
}


function sectionLoadedListener(evt:Event) {
    var section=evt.target.content;

    if (oldSection) {
        TweenMax.to(oldSection, 1,{alpha:0, ease:Quint.easeInOut});
        removeKid.addEventListener(TimerEvent.TIMER, timerListener);
        function timerListener(e:TimerEvent):void {
        this.removeChild(oldSection); //I get error #1006 removeChild is not a function. Why?!
        }
    }

    removeKid.start();
    oldSection=section;

    this.addChild(section);
    //section.alpha=0;
    section.alpha=0;
    TweenMax.to(section, 1,{delay:0.2, alpha:1, ease:Quint.easeInOut});
    section.x=0;
    section.y=0;
    //TweenLite.to(section,0.5,{x:-537.9, y:-189.5, alpha:1, ease:Quart.easeInOut});

}

defaultPage.addEventListener(TimerEvent.TIMER, openingListener);
function openingListener(evt:TimerEvent):void {
    loadSection("loaded.swf");
}
defaultPage.start();
/*this.exit_mc.addEventListener(MouseEvent.CLICK, clickListener2);*/
//Main Content area =====================================


//Main Menu UI =====================================================
bl_mc.width=0;
bl_mc.x=109.55;
bl_mc.y=520.5;

windowClings_btn.visible=false;
easelInserts_btn.visible=false;
bannerAds_btn.visible=false;
emailTemplates_btn.visible=false;

windowClings_btn.alpha=0;
easelInserts_btn.alpha=0;
bannerAds_btn.alpha=0;
emailTemplates_btn.alpha=0;

sub_mc.x=-84;
TweenMax.to(emailTemplates_btn, 0.5,{delay:1.8, y:571.2, autoAlpha:1, ease:Quint.easeInOut});
TweenMax.to(bannerAds_btn, 0.5,{delay:1.7, y:552.2, autoAlpha:1, ease:Quint.easeInOut});
TweenMax.to(easelInserts_btn, 0.5,{delay:1.6, y:532.95, autoAlpha:1, ease:Quint.easeInOut});
TweenMax.to(windowClings_btn, 0.5,{delay:1.5, y:513.7, autoAlpha:1, ease:Quint.easeInOut});
TweenMax.to(sub_mc,1,{delay:1.9, x:148, ease:Quint.easeInOut});
TweenMax.to(scroll_mc,2,{delay:2, y:105.7, autoAlpha:1, ease:Quint.easeOut});
TweenMax.to(bl_mc,1,{delay:2, y:520.5, x:109.55, width:244.9, ease:Quint.easeInOut});
TweenMax.to(exit_mc,1,{delay:2, alpha:1, x:732, y:9, ease:Quint.easeOut});

//Main Menu UI =====================================================

//Sub Menu ==============================================================
this.addEventListener(MouseEvent.CLICK, clickListener0);
function clickListener0(evt:Event) {


    if (evt.target.name=="windowClings_btn") {
        if (bl_mc.y==539.2) {
            TweenMax.to(scroll2_mc.scrollbar, 0.7,{autoAlpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll2_mc.text.thumb_mc.thumb1_mc, 0.7,{delay:0.2, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll2_mc.text.thumb_mc.thumb2_mc, 0.7,{delay:0.3, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll2_mc.text.thumb_mc.thumb3_mc, 0.7,{delay:0.4, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll2_mc.text.thumb_mc.thumb4_mc, 0.7,{delay:0.5, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll2_mc.text.thumb_mc.thumb5_mc, 0.7,{delay:0.6, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll2_mc.text.thumb_mc.thumb6_mc, 0.7,{delay:0.7, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll2_mc.text.thumb_mc.thumb7_mc, 0.7,{delay:0.8, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll2_mc.text.thumb_mc.thumb8_mc, 0.7,{delay:0.9, alpha:0, ease:Quint.easeInOut});

            TweenMax.to(scroll_mc.scrollbar, 0.7,{delay:2.6, autoAlpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb1_mc, 0.7,{delay:2.5, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb2_mc, 0.7,{delay:2.4, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb3_mc, 0.7,{delay:2.3, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb4_mc, 0.7,{delay:2.2, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb5_mc, 0.7,{delay:2.1, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb6_mc, 0.7,{delay:2, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb7_mc, 0.7,{delay:1.9, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb8_mc, 0.7,{delay:1.8, alpha:1, ease:Quint.easeInOut});

            TweenMax.to(bl_mc,1,{delay:1, y:539.2, x:99.8, width:0, ease:Quint.easeOut});
            TweenMax.to(bl_mc,0,{delay:1.5, y:520.5, x:109.55, width:0, ease:Quint.easeOut});
            TweenMax.to(bl_mc,1,{delay:1.6, y:520.5, x:109.55, width:244.9, ease:Quint.easeInOut});
            TweenMax.to(scroll2_mc, 1.9,{autoAlpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc, 0,{delay:2, y:105.7, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc, 2,{delay:1.9,autoAlpha:1, ease:Quint.easeInOut});
            TweenMax.to(sub_mc,1,{delay:1, x:-84, ease:Quint.easeOut});
            TweenMax.to(sub_mc,1,{delay:1.5, x:148, ease:Quint.easeInOut});

        }
        if (bl_mc.y==557.2) {
            TweenMax.to(scroll3_mc.scrollbar, 0.7,{autoAlpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll3_mc.text.thumb_mc.thumb1_mc, 0.7,{delay:0.2, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll3_mc.text.thumb_mc.thumb2_mc, 0.7,{delay:0.3, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll3_mc.text.thumb_mc.thumb3_mc, 0.7,{delay:0.4, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll3_mc.text.thumb_mc.thumb4_mc, 0.7,{delay:0.5, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll3_mc.text.thumb_mc.thumb5_mc, 0.7,{delay:0.6, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll3_mc.text.thumb_mc.thumb6_mc, 0.7,{delay:0.7, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll3_mc.text.thumb_mc.thumb7_mc, 0.7,{delay:0.8, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll3_mc.text.thumb_mc.thumb8_mc, 0.7,{delay:0.9, alpha:0, ease:Quint.easeInOut});

            TweenMax.to(scroll_mc.scrollbar, 0.7,{delay:2.6, autoAlpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb1_mc, 0.7,{delay:2.5, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb2_mc, 0.7,{delay:2.4, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb3_mc, 0.7,{delay:2.3, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb4_mc, 0.7,{delay:2.2, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb5_mc, 0.7,{delay:2.1, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb6_mc, 0.7,{delay:2, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb7_mc, 0.7,{delay:1.9, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb8_mc, 0.7,{delay:1.8, alpha:1, ease:Quint.easeInOut});


            TweenMax.to(bl_mc,1,{delay:1, y:557.2, x:89.2, width:0, ease:Quint.easeOut});
            TweenMax.to(bl_mc,0,{delay:1.5, y:520.5, x:109.55, width:0, ease:Quint.easeOut});
            TweenMax.to(bl_mc,1,{delay:1.6, y:520.5, x:109.55, width:244.9, ease:Quint.easeInOut});
            TweenMax.to(scroll3_mc, 1.9,{autoAlpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc, 0,{delay:2, y:105.7, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc, 2,{delay:1.9,autoAlpha:1, ease:Quint.easeInOut});
            TweenMax.to(sub_mc,1,{delay:1, x:-84, ease:Quint.easeOut});
            TweenMax.to(sub_mc,1,{delay:1.5, x:148, ease:Quint.easeInOut});
        }
        if (bl_mc.y==576.8) {
            TweenMax.to(scroll_mc.scrollbar, 0.7,{autoAlpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb1_mc, 0.7,{delay:0.2, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb2_mc, 0.7,{delay:0.3, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb3_mc, 0.7,{delay:0.4, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb4_mc, 0.7,{delay:0.5, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb5_mc, 0.7,{delay:0.6, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb6_mc, 0.7,{delay:0.7, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb7_mc, 0.7,{delay:0.8, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb8_mc, 0.7,{delay:0.9, alpha:0, ease:Quint.easeInOut});

            TweenMax.to(scroll_mc.scrollbar, 0.7,{delay:2.6, autoAlpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb1_mc, 0.7,{delay:2.5, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb2_mc, 0.7,{delay:2.4, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb3_mc, 0.7,{delay:2.3, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb4_mc, 0.7,{delay:2.2, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb5_mc, 0.7,{delay:2.1, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb6_mc, 0.7,{delay:2, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb7_mc, 0.7,{delay:1.9, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb8_mc, 0.7,{delay:1.8, alpha:1, ease:Quint.easeInOut});


            TweenMax.to(bl_mc,1,{delay:1, y:576.8, x:112, width:0, ease:Quint.easeOut});
            TweenMax.to(bl_mc,0,{delay:1.5, y:520.5, x:109.55, width:0, ease:Quint.easeOut});
            TweenMax.to(bl_mc,1,{delay:1.6, y:520.5, x:109.55, width:244.9, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc, 1.9,{autoAlpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc, 0,{delay:2, y:105.7, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc, 2,{delay:1.9,autoAlpha:1, ease:Quint.easeInOut});
            TweenMax.to(sub_mc,1,{delay:1, x:-84, ease:Quint.easeOut});
            TweenMax.to(sub_mc,1,{delay:1.5, x:148, ease:Quint.easeInOut});
        }
    }
    if (evt.target.name=="easelInserts_btn") {
        if (bl_mc.y==520.5) {
            TweenMax.to(scroll_mc.scrollbar, 0.7,{autoAlpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb1_mc, 0.7,{delay:0.2, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb2_mc, 0.7,{delay:0.3, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb3_mc, 0.7,{delay:0.4, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb4_mc, 0.7,{delay:0.5, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb5_mc, 0.7,{delay:0.6, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb6_mc, 0.7,{delay:0.4, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb7_mc, 0.7,{delay:0.5, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb8_mc, 0.7,{delay:0.6, alpha:0, ease:Quint.easeInOut});


            TweenMax.to(scroll2_mc.scrollbar, 0.7,{delay:2.6, autoAlpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll2_mc.text.thumb_mc.thumb1_mc, 0.7,{delay:2.5, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll2_mc.text.thumb_mc.thumb2_mc, 0.7,{delay:2.4, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll2_mc.text.thumb_mc.thumb3_mc, 0.7,{delay:2.3, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll2_mc.text.thumb_mc.thumb4_mc, 0.7,{delay:2.2, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll2_mc.text.thumb_mc.thumb5_mc, 0.7,{delay:2.1, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll2_mc.text.thumb_mc.thumb6_mc, 0.7,{delay:2, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll2_mc.text.thumb_mc.thumb7_mc, 0.7,{delay:1.9, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll2_mc.text.thumb_mc.thumb8_mc, 0.7,{delay:1.8, alpha:1, ease:Quint.easeInOut});

            TweenMax.to(bl_mc,1,{delay:1, y:520.5, x:109.55, width:0, ease:Quint.easeOut});
            TweenMax.to(bl_mc,0,{delay:1.5, y:539.2, x:99.8, width:0, ease:Quint.easeOut});
            TweenMax.to(bl_mc,1,{delay:1.6, y:539.2, x:99.8, width:254.9, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc, 1.9,{autoAlpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll2_mc, 0,{delay:2, y:125.2, ease:Quint.easeInOut});
            TweenMax.to(scroll2_mc, 2,{delay:1.9,autoAlpha:1, ease:Quint.easeInOut});
            TweenMax.to(sub_mc,1,{delay:1, x:-84, ease:Quint.easeOut});
            TweenMax.to(sub_mc,1,{delay:1.5, x:148, ease:Quint.easeInOut});
        }
        if (bl_mc.y==557.2) {
            TweenMax.to(scroll3_mc.scrollbar, 0.7,{autoAlpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll3_mc.text.thumb_mc.thumb1_mc, 0.7,{delay:0.2, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll3_mc.text.thumb_mc.thumb2_mc, 0.7,{delay:0.3, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll3_mc.text.thumb_mc.thumb3_mc, 0.7,{delay:0.4, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll3_mc.text.thumb_mc.thumb4_mc, 0.7,{delay:0.5, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll3_mc.text.thumb_mc.thumb5_mc, 0.7,{delay:0.6, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll3_mc.text.thumb_mc.thumb6_mc, 0.7,{delay:0.7, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll3_mc.text.thumb_mc.thumb7_mc, 0.7,{delay:0.8, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll3_mc.text.thumb_mc.thumb8_mc, 0.7,{delay:0.9, alpha:0, ease:Quint.easeInOut});


            TweenMax.to(scroll2_mc.scrollbar, 0.7,{delay:2.6, autoAlpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll2_mc.text.thumb_mc.thumb1_mc, 0.7,{delay:2.5, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll2_mc.text.thumb_mc.thumb2_mc, 0.7,{delay:2.4, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll2_mc.text.thumb_mc.thumb3_mc, 0.7,{delay:2.3, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll2_mc.text.thumb_mc.thumb4_mc, 0.7,{delay:2.2, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll2_mc.text.thumb_mc.thumb5_mc, 0.7,{delay:2.1, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll2_mc.text.thumb_mc.thumb6_mc, 0.7,{delay:2, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll2_mc.text.thumb_mc.thumb7_mc, 0.7,{delay:1.9, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll2_mc.text.thumb_mc.thumb8_mc, 0.7,{delay:1.8, alpha:1, ease:Quint.easeInOut});

            TweenMax.to(bl_mc,1,{delay:1, y:557.2, x:89.2, width:0, ease:Quint.easeOut});
            TweenMax.to(bl_mc,0,{delay:1.5, y:539.2, x:99.8, width:0, ease:Quint.easeOut});
            TweenMax.to(bl_mc,1,{delay:1.6, y:539.2, x:99.8, width:254.9, ease:Quint.easeInOut});
            TweenMax.to(scroll3_mc, 1.9,{autoAlpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll2_mc, 0,{delay:2, y:125.2, ease:Quint.easeInOut});
            TweenMax.to(scroll2_mc, 2,{delay:1.9,autoAlpha:1, ease:Quint.easeInOut});
            TweenMax.to(sub_mc,1,{delay:1, x:-84, ease:Quint.easeOut});
            TweenMax.to(sub_mc,1,{delay:1.5, x:148, ease:Quint.easeInOut});
        }
        if (bl_mc.y==576.8) {
            TweenMax.to(scroll_mc.scrollbar, 0.7,{autoAlpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb1_mc, 0.7,{delay:0.2, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb2_mc, 0.7,{delay:0.3, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb3_mc, 0.7,{delay:0.4, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb4_mc, 0.7,{delay:0.5, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb5_mc, 0.7,{delay:0.6, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb6_mc, 0.7,{delay:0.7, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb7_mc, 0.7,{delay:0.8, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb8_mc, 0.7,{delay:0.9, alpha:0, ease:Quint.easeInOut});


            TweenMax.to(scroll2_mc.scrollbar, 0.7,{delay:2.6, autoAlpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll2_mc.text.thumb_mc.thumb1_mc, 0.7,{delay:2.5, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll2_mc.text.thumb_mc.thumb2_mc, 0.7,{delay:2.4, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll2_mc.text.thumb_mc.thumb3_mc, 0.7,{delay:2.3, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll2_mc.text.thumb_mc.thumb4_mc, 0.7,{delay:2.2, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll2_mc.text.thumb_mc.thumb5_mc, 0.7,{delay:2.1, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll2_mc.text.thumb_mc.thumb6_mc, 0.7,{delay:2, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll2_mc.text.thumb_mc.thumb7_mc, 0.7,{delay:1.9, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll2_mc.text.thumb_mc.thumb8_mc, 0.7,{delay:1.8, alpha:1, ease:Quint.easeInOut});

            TweenMax.to(bl_mc,1,{delay:1, y:576.8, x:112, width:0, ease:Quint.easeOut});
            TweenMax.to(bl_mc,0,{delay:1.5, y:539.2, x:99.8, width:0, ease:Quint.easeOut});
            TweenMax.to(bl_mc,1,{delay:1.6, y:539.2, x:99.8, width:254.9, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc, 1.9,{autoAlpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll2_mc, 0,{delay:2, y:125.2, ease:Quint.easeInOut});
            TweenMax.to(scroll2_mc, 2,{delay:1.9,autoAlpha:1, ease:Quint.easeInOut});
            TweenMax.to(sub_mc,1,{delay:1, x:-84, ease:Quint.easeOut});
            TweenMax.to(sub_mc,1,{delay:1.5, x:148, ease:Quint.easeInOut});
        }
    }
    if (evt.target.name=="bannerAds_btn") {
        if (bl_mc.y==520.5) {
            TweenMax.to(scroll_mc.scrollbar, 0.7,{autoAlpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb1_mc, 0.7,{delay:0.2, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb2_mc, 0.7,{delay:0.3, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb3_mc, 0.7,{delay:0.4, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb4_mc, 0.7,{delay:0.5, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb5_mc, 0.7,{delay:0.6, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb6_mc, 0.7,{delay:0.7, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb7_mc, 0.7,{delay:0.8, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb8_mc, 0.7,{delay:0.9, alpha:0, ease:Quint.easeInOut});

            TweenMax.to(scroll3_mc.scrollbar, 0.7,{delay:2.6, autoAlpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll3_mc.text.thumb_mc.thumb1_mc, 0.7,{delay:2.5, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll3_mc.text.thumb_mc.thumb2_mc, 0.7,{delay:2.4, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll3_mc.text.thumb_mc.thumb3_mc, 0.7,{delay:2.3, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll3_mc.text.thumb_mc.thumb4_mc, 0.7,{delay:2.2, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll3_mc.text.thumb_mc.thumb5_mc, 0.7,{delay:2.1, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll3_mc.text.thumb_mc.thumb6_mc, 0.7,{delay:2, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll3_mc.text.thumb_mc.thumb7_mc, 0.7,{delay:1.9, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll3_mc.text.thumb_mc.thumb8_mc, 0.7,{delay:1.8, alpha:1, ease:Quint.easeInOut});


            TweenMax.to(bl_mc,1,{delay:1, y:520.5, x:109.55, width:0, ease:Quint.easeOut});
            TweenMax.to(bl_mc,0,{delay:1.5, y:557.2, x:89.2, width:0, ease:Quint.easeOut});
            TweenMax.to(bl_mc,1,{delay:1.6, y:557.2, x:89.2, width:266.6, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc, 1.9,{autoAlpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll3_mc, 0,{delay:2, y:143.2, ease:Quint.easeInOut});
            TweenMax.to(scroll3_mc, 2,{delay:1.9,autoAlpha:1, ease:Quint.easeInOut});
            TweenMax.to(sub_mc,1,{delay:1, x:-84, ease:Quint.easeOut});
            TweenMax.to(sub_mc,1,{delay:1.5, x:148, ease:Quint.easeInOut});

        }
        if (bl_mc.y==539.2) {
            TweenMax.to(scroll2_mc.scrollbar, 0.7,{autoAlpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll2_mc.text.thumb_mc.thumb1_mc, 0.7,{delay:0.2, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll2_mc.text.thumb_mc.thumb2_mc, 0.7,{delay:0.3, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll2_mc.text.thumb_mc.thumb3_mc, 0.7,{delay:0.4, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll2_mc.text.thumb_mc.thumb4_mc, 0.7,{delay:0.5, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll2_mc.text.thumb_mc.thumb5_mc, 0.7,{delay:0.6, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll2_mc.text.thumb_mc.thumb6_mc, 0.7,{delay:0.7, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll2_mc.text.thumb_mc.thumb7_mc, 0.7,{delay:0.8, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll2_mc.text.thumb_mc.thumb8_mc, 0.7,{delay:0.9, alpha:0, ease:Quint.easeInOut});

            TweenMax.to(scroll3_mc.scrollbar, 0.7,{delay:2.6, autoAlpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll3_mc.text.thumb_mc.thumb1_mc, 0.7,{delay:2.5, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll3_mc.text.thumb_mc.thumb2_mc, 0.7,{delay:2.4, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll3_mc.text.thumb_mc.thumb3_mc, 0.7,{delay:2.3, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll3_mc.text.thumb_mc.thumb4_mc, 0.7,{delay:2.2, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll3_mc.text.thumb_mc.thumb5_mc, 0.7,{delay:2.1, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll3_mc.text.thumb_mc.thumb6_mc, 0.7,{delay:2, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll3_mc.text.thumb_mc.thumb7_mc, 0.7,{delay:1.9, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll3_mc.text.thumb_mc.thumb8_mc, 0.7,{delay:1.8, alpha:1, ease:Quint.easeInOut});


            TweenMax.to(bl_mc,1,{delay:1, y:539.2, x:99.8, width:0, ease:Quint.easeOut});
            TweenMax.to(bl_mc,0,{delay:1.5, y:557.2, x:89.2, width:0, ease:Quint.easeOut});
            TweenMax.to(bl_mc,1,{delay:1.6, y:557.2, x:89.2, width:266.6, ease:Quint.easeInOut});
            TweenMax.to(scroll2_mc, 1.9,{autoAlpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll3_mc, 0,{delay:2, y:143.2, ease:Quint.easeInOut});
            TweenMax.to(scroll3_mc, 2,{delay:1.9,autoAlpha:1, ease:Quint.easeInOut});
            TweenMax.to(sub_mc,1,{delay:1, x:-84, ease:Quint.easeOut});
            TweenMax.to(sub_mc,1,{delay:1.5, x:148, ease:Quint.easeInOut});
        }
        if (bl_mc.y==576.8) {
            TweenMax.to(scroll_mc.scrollbar, 0.7,{autoAlpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb1_mc, 0.7,{delay:0.2, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb2_mc, 0.7,{delay:0.3, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb3_mc, 0.7,{delay:0.4, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb4_mc, 0.7,{delay:0.5, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb5_mc, 0.7,{delay:0.6, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb6_mc, 0.7,{delay:0.7, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb7_mc, 0.7,{delay:0.8, alpha:0, ease:Quint.easeInOut});
            TweenMax.to(scroll_mc.text.thumb_mc.thumb8_mc, 0.7,{delay:0.9, alpha:0, ease:Quint.easeInOut});

            TweenMax.to(scroll3_mc.scrollbar, 0.7,{delay:2.6, autoAlpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll3_mc.text.thumb_mc.thumb1_mc, 0.7,{delay:2.5, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll3_mc.text.thumb_mc.thumb2_mc, 0.7,{delay:2.4, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll3_mc.text.thumb_mc.thumb3_mc, 0.7,{delay:2.3, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll3_mc.text.thumb_mc.thumb4_mc, 0.7,{delay:2.2, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll3_mc.text.thumb_mc.thumb5_mc, 0.7,{delay:2.1, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll3_mc.text.thumb_mc.thumb6_mc, 0.7,{delay:2, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll3_mc.text.thumb_mc.thumb7_mc, 0.7,{delay:1.9, alpha:1, ease:Quint.easeInOut});
            TweenMax.to(scroll3_mc.text.thumb_mc.thumb8_mc, 0.7,{delay:1.8, alpha:1, ease:Quint.easeInOut});

            TweenMax.to(bl_mc,1,{delay:1, y:576.8, x:112, width
4

2 回答 2

0

您可能会因为嵌套函数的方式(存在问题的方式)而失去上下文。似乎认为“这个”既不是(1)舞台,也不是(2)DisplayObject。当您在该行上抛出断点并在调试中运行时会发生什么?

编辑:您将 eventListener 添加到 Timer 对象上—— Timer 不是 DisplayObject,因此没有 removeChild 作为函数。

于 2010-03-29T18:54:51.473 回答
0

现在您已经过去了 #1006(尝试在 Timer 对象上调用 DisplayObject 方法)并遇到了 #2025 错误(无法删除不存在的孩子),这是我对正在发生的事情的评估。

这里的主要问题是您要向共享的 removeKid 计时器添加多个侦听器(每次单击一个),并且它们都引用相同的 oldSection 实例。因此,在您单击 10 次后,您的 timerListener 函数将尝试调用 removeChild(oldSection) 10 次(其中 9 次将失败并出现错误 #2025)。

此处最简单的解决方法是利用 TweenMax 的 onComplete 参数,因为您可能希望在旧的 DisplayObject 完全淡出后删除它。这也将允许您删除共享的 removeKid 计时器。例如:

TweenMax.to(oldSection, 1, {
    alpha:0,
    ease:Quint.easeInOut,
    onComplete:fadeCompletedHandler,
    onCompleteParams: [oldSection]
    });

function fadeCompletedHandler(child:DisplayObject):void
{
    removeChild(child);
}
于 2011-02-02T05:12:03.817 回答