package com { import flash.display.*; import flash.events.*; import flash.net.*; import com.TweenNano; public class Expanded extends MovieClip { public var countCurrent:int = 1; public var countTotal:int = 3; public var arrayNames:Array = ["pizza", "fritter", "stirFry"]; public function Expanded() { } public function dummyInteractions():void { EBBase.UserActionCounter("arrow_left"); EBBase.UserActionCounter("arrow_right"); EBBase.Clickthrough("logo_exit"); EBBase.Clickthrough("default_exit"); EBBase.Clickthrough("pizza_exit"); EBBase.Clickthrough("fritter_exit"); EBBase.Clickthrough("stirFry_exit"); } public function startTheShow(e:Event = null){ stop(); frame01(); cta_mc.addEventListener(MouseEvent.CLICK, clickThrough); cta_mc.buttonMode = true; logo_mc.addEventListener(MouseEvent.CLICK, clickThrough); logo_mc.buttonMode = true; close_btn.addEventListener(MouseEvent.CLICK, closeBanner); arrowLeft_mc.addEventListener(MouseEvent.CLICK, findNext); arrowLeft_mc.addEventListener(MouseEvent.MOUSE_OVER, fadeInOut); arrowLeft_mc.addEventListener(MouseEvent.MOUSE_OUT, fadeInOut); arrowLeft_mc.mouseChildren = false; arrowLeft_mc.buttonMode = true; arrowLeft_mc.tint_mc.alpha = 0; arrowRight_mc.addEventListener(MouseEvent.CLICK, findNext); arrowRight_mc.addEventListener(MouseEvent.MOUSE_OVER, fadeInOut); arrowRight_mc.addEventListener(MouseEvent.MOUSE_OUT, fadeInOut); arrowRight_mc.mouseChildren = false; arrowRight_mc.buttonMode = true; arrowRight_mc.tint_mc.alpha = 0; carousel_mc.image_2_mc.alpha = 0; carousel_mc.image_3_mc.alpha = 0; carousel_mc.text_2_mc.alpha = 0; carousel_mc.text_3_mc.alpha = 0; carousel_mc.product_2_mc.alpha = 0; carousel_mc.product_3_mc.alpha = 0; } public function frame01(){ } public function findNext(e:Event){ if(e.target.name == "arrowLeft_mc"){ countCurrent -= 1; EBBase.UserActionCounter("arrow_left"); }else if(e.target.name == "arrowRight_mc"){ countCurrent += 1; EBBase.UserActionCounter("arrow_right"); } if(countCurrent > countTotal){ countCurrent = 1; }else if(countCurrent < 1){ countCurrent = countTotal; } nextOne(); } public function nextOne(e:Event = null){ for(var i:int = 1; i <= countTotal; i++){ var tempImage:Object = carousel_mc["image_" + i + "_mc"]; var tempProduct:Object = carousel_mc["product_" + i + "_mc"]; var tempText:Object = carousel_mc["text_" + i + "_mc"]; var whichAlpha:Number = 0.00; var timeAnim:Number = 0.50; if(i == countCurrent){ whichAlpha = 1.00; timeAnim = 0.25; tempImage.alpha = 0.00; carousel_mc.setChildIndex(MovieClip(tempImage), carousel_mc.numChildren-1); TweenNano.to(tempImage, timeAnim, {alpha:whichAlpha}); } TweenNano.to(tempProduct, timeAnim, {alpha:whichAlpha, overwrite:"all"}); TweenNano.to(tempText, timeAnim, {alpha:whichAlpha, overwrite:"all"}); } } public function fadeInOut(e:Event){ var tempType:String = e.type; var tempAlpha:Number = 0; if(tempType == "mouseOver"){ tempAlpha = 1; } TweenNano.to(e.target.tint_mc, .25, {alpha:tempAlpha}); } public function closeBanner(e:Event){ EBBase.CloseAd(); } public function clickThrough(e:Event) { var nameTarget:String = e.target.name; var nameExit:String; if(nameTarget == "cta_mc"){ nameExit = arrayNames[countCurrent-1]; }else if(nameTarget == "logo_mc"){ nameExit = "logo"; }else{ nameExit = "default"; } EB.Clickthrough(nameExit + "_exit"); } } }