package { import flash.display.Loader; import flash.display.Sprite; import flash.display.MovieClip; import flash.events.*; import flash.net.URLRequest; import caurina.transitions.*; public dynamic class MainFlash extends Sprite { private var loadCount:Number = 0; private var index:Number = 0; private var url:Array=["mainVisual01.swf", "mainVisual02.swf", "mainVisual03.swf", "mainVisual04.swf"]; private var visualMovies:Array; public function MainFlash() { loaders = new Array(url.length); visualMovies = new Array(); for (var i:Number=0; i 3) idx = 0; changeVisual(idx); } private function changeVisual(index:Number) { trace("changeVisual("+index+")"); var loader:Loader; if (index != this.index) { for (var i:Number=0 ; i<4; i++) { this["btn0"+(i+1)+"_on"].y = 6000; try { loader = this.visualArea.getChildAt(i); loader.alpha = 0; loader.content.gotoAndStop(0); } catch (e:Error) { trace(e); } } try { //Tweener.addTween(this.visualArea.getChildAt(this.index), {alpha:0, time:1}); //Tweener.addTween(this.visualArea.getChildAt(index), {alpha:1, time:1}); this["btn0"+(index+1)+"_on"].y = 337; //415 loader = this.visualArea.getChildAt(index); loader.alpha = 1; loader.content.gotoAndPlay(0); } catch (e:Error) { changeVisual(0); } } this.index = index; } private function clickEventHandler(e:MouseEvent) { var index = 0; switch(e.currentTarget.name) { case "btnPrev": index = (this.index-1 < 0)? url.length-1 : this.index-1; break; case "btnNext": index = (this.index+1 >= url.length)? 0 : this.index+1; break; case "btnVisual1": index = 0; break; case "btnVisual2": index = 1; break; case "btnVisual3": index = 2; break; case "btnVisual4": index = 3; break; } changeVisual(index); } private function configureListeners(dispatcher:IEventDispatcher):void { dispatcher.addEventListener(Event.COMPLETE, completeHandler); dispatcher.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler); dispatcher.addEventListener(Event.INIT, initHandler); dispatcher.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler); dispatcher.addEventListener(Event.OPEN, openHandler); dispatcher.addEventListener(ProgressEvent.PROGRESS, progressHandler); dispatcher.addEventListener(Event.UNLOAD, unLoadHandler); } private function completeHandler(event:Event):void { event.target.content.stop(); event.target.content.addEventListener("endMovie", endMovieHandler); this.visualArea.getChildAt(0).content.play(); trace("completeHandler: " + event); } private function httpStatusHandler(event:HTTPStatusEvent):void { trace("httpStatusHandler: " + event); } private function initHandler(event:Event):void { trace("initHandler: " + event); } private function ioErrorHandler(event:IOErrorEvent):void { trace("ioErrorHandler: " + event); } private function openHandler(event:Event):void { trace("openHandler: " + event); } private function progressHandler(event:ProgressEvent):void { trace("progressHandler: bytesLoaded=" + event.bytesLoaded + " bytesTotal=" + event.bytesTotal); } private function unLoadHandler(event:Event):void { trace("unLoadHandler: " + event); } } }