I'm trying to build a conditional statement that will addChild and removeChild at different Timer Delays. Before I go any further, I thought, I should mention that I'm usinig TweenMax to ease the alpha of ease Child from 1 to 0 and back during the process to imitate a fade-in/out.
I'm getting issue with only one line - inside a conditional statement. It's running "OK". The movie runs as I want it, but the remove/addChild transitions are not at the speed I want it at. I am getting an error message in the output, but other than that, the movie runs fine.
Please note, I'm still quite the novice in AS3. My script is repetitive and long. Sorry! I've commented where the error is located. Thank you in advanced!!
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,开发者_如何学C0,{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
you're probably losing context with the way you have the function nested (the one that is having the issue). It seems to be thinking that "this" isn't either (1) the stage, or (2) a DisplayObject. What happens when you run throw a breakpoint on that line and run in debug?
Edit: You're adding the eventListener onto a Timer object -- Timer is not a DisplayObject, and therefore doesn't have removeChild as a function.
Now that you're past the #1006 (trying to call DisplayObject methods on a Timer object) and on to the #2025 error (can't remove a child that isn't there), here's my assessment of what's going on.
The main issue here is that you're adding multiple listeners (one per click) to the shared removeKid timer, and they all reference the same oldSection instance. So after you've clicked 10 times, your timerListener function will attempt to call removeChild(oldSection) 10 times (9 of which will fail with error #2025).
The simplest fix here would be to take advantage of the onComplete parameter to TweenMax, as you presumably want to remove the old DisplayObject once it's completely faded out. This will also allow you to remove the shared removeKid timer. For example:
TweenMax.to(oldSection, 1, {
alpha:0,
ease:Quint.easeInOut,
onComplete:fadeCompletedHandler,
onCompleteParams: [oldSection]
});
function fadeCompletedHandler(child:DisplayObject):void
{
removeChild(child);
}
精彩评论