2 Replies Latest reply on Sep 11, 2010 8:47 AM by beno12345

    This Screen Will Self-Destruct in 5 Seconds!

    beno12345 Level 1

      Hi;

      For some reason, I have a script in AS3 that presents my movie exactly as I want it to...for 5 seconds, and then, poof! It disappears, leaving a white screen. I thought maybe it was a tween, but I have no 5 or 6 second tweens that could be the culprit. Without burdening you all with the entire script, any ideas as to what this could be?

      TIA,

      beno

        • 1. Re: This Screen Will Self-Destruct in 5 Seconds!
          Ganesh_Palwe Level 3

          Difficult to tell without code.

          • 2. Re: This Screen Will Self-Destruct in 5 Seconds!
            beno12345 Level 1

            You want the whole code? Ok...

             

            package
            {
                import fl.transitions.*;
                import Navigate;
                import URLClip;
                import flash.events.MouseEvent;
                import flash.text.TextLineMetrics;
                import flash.text.TextField;
                import flash.text.TextFormat;
                import flash.text.TextFormatAlign;
                import flash.text.TextFieldAutoSize;
                import flash.geom.Transform;
                import flash.events.Event;
                import com.greensock.*;
                import com.greensock.plugins.*;
                import com.greensock.easing.*;
                import flash.display.MovieClip;
                import flash.display.Sprite;
                import flash.display.Bitmap;
                import flash.display.BitmapData;
                import flash.filters.*;
                import flash.filters.BitmapFilterQuality;
                import flash.events.IOErrorEvent;
                import flash.net.URLRequest;
                import flash.display.Loader;
                import flash.display.LoaderInfo;
                import flash.display.DisplayObject;
               
                [SWF(width=1008, height=548, backgroundColor=0x000000, frameRate=30, backgroundColor="0x000000")]
               
                public class SeaFlightSplash extends MovieClip
                {
                    public var textureMap:BitmapData;
                    public var myLogo:Bitmap;
                    var parent_container:Sprite = new Sprite();
                    var parent_container2:Sprite = new Sprite();
                    var parent_container3:Sprite = new Sprite();
                    var parent_container4:Sprite = new Sprite();
                    var parent_container5:Sprite = new Sprite();
                    var parent_container6:Sprite = new Sprite();
                    var parent_container7:Sprite = new Sprite();
                    var parent_container8:Sprite = new Sprite();
                    var parent_container9:Sprite = new Sprite();
                    var parent_container10:Sprite = new Sprite();
                    var parent_container11:Sprite = new Sprite();
                    var parent_container12:Sprite = new Sprite();
                    var parent_container13:Sprite = new Sprite();
                    var fontContainer:MovieClip = new MovieClip();
                    var degX:Number = 15;
                    var degY:Number = 15;
                    var myClientName:TextField = new TextField();
                    var myFont2:String = new String();
                    var mySize:int = new int();
                    var navName:String = new String();
                    var navURL:String = new String();
                    var leftTextColor:uint = new uint();
                    var myBorder:Boolean = new Boolean;
                    var myBorderColor:uint = new uint();
                    var myBackgroundColor:uint = new uint();
                    var myX:int = new int();
                    var myY:int = new int();
                    var myNavigation:TextField = new TextField();
                    var myGraphicsFill:uint = 0xffffff;
                    var mainPageSquare:Sprite = new Sprite();
                    var cloudTween:Tween = new Tween(parent_container2,"x",null,0,300,1,true);
                    var leftText:TextField = new TextField();
                    var leftText2:TextField = new TextField();
                    var leftText3:TextField = new TextField();
                    var rightText:TextField = new TextField();
                    var rightText2:TextField = new TextField();
                    var rightText3:TextField = new TextField();
                    var leftSquare:Sprite = new Sprite;
                    var rightSquare:Sprite = new Sprite;
                   
                    public function SeaFlightSplash()
                    {
                        LeftSplash();
                    }
                   
                    function LeftWhiteBg():void
                    {
                        leftSquare.graphics.beginFill(0xffffff, 1);
                        leftSquare.graphics.drawRect(45, 65, 205, 100);
                        leftSquare.graphics.endFill();
                        RightWhiteBg();
                    }

             

                    function RightWhiteBg():void
                    {
                        rightSquare.graphics.beginFill(0xffffff, 1);
                        rightSquare.graphics.drawRect(777, 65, 163, 80);
                        rightSquare.graphics.endFill();
                    }

             

                    function LeftSplash():void
                    {
                        parent_container9 = new MovieClip();
                        parent_container10.addChild(parent_container9)
                        var path2:String = "images/splashLeft.png";
                        var req2:URLRequest = new URLRequest(path2);
                        var loader:Loader = new Loader();
                        loader.load(req2);
                        loader.addEventListener(IOErrorEvent.IO_ERROR, function(e:IOErrorEvent):void{ trace(e) });
                        loader.contentLoaderInfo.addEventListener(Event.COMPLETE, LeftSplashLoaded);
                    }

             

                    function LeftSplashLoaded(evt:Event):void
                    {
                        var loaderInfo:LoaderInfo = evt.target as LoaderInfo;
                        var displayObject:DisplayObject = loaderInfo.content;
                        displayObject.width = 504;
                        displayObject.height = 548;
                        displayObject.x = -5;
                        displayObject.y = 0;
                        parent_container9.addChild(displayObject);
                        LeftSplashSquare();
                    }
                   
                    function LeftSplashCover():void
                    {
                        parent_container10.addChild(parent_container5);
                        parent_container5.graphics.beginFill(0x065566);
                        parent_container5.graphics.drawRect(0, 0, 504, 548);
                        parent_container5.graphics.endFill();
                        parent_container5.alpha = .5;
                        RightSplash();
                    }
                   
                    function LeftSplashSquare():void
                    {
                        var square:Sprite = new Sprite();
                        var myURL:TextField = new TextField();
                        myURL.text = 'Business.html';
                        myURL.x = -100;
                        myURL.y = -100;
                        var navSprite:URLClip = new URLClip();
                        navSprite.url = 'Business.html';
                        navSprite.name = navName;
                        navSprite.addChild(parent_container10);
                        navSprite.addChild(myURL);
                        var len:int = myNavigation.numLines;
                        for (var i:int = 0; i < len; i++)
                        {
                            var metrics:TextLineMetrics = myNavigation.getLineMetrics(i);
                            with(navSprite.graphics)
                            {
                                beginFill(myGraphicsFill, 1);
                                drawRoundRect(myNavigation.x, myNavigation.y, metrics.width + 4, metrics.height + metrics.descent + 1, 20);
                                endFill();
                            }
                        }
                        addChild(navSprite);
                        navSprite.addEventListener(MouseEvent.MOUSE_OVER, LeftSplashOnMouseOverHandler);
                        navSprite.addEventListener(MouseEvent.MOUSE_OUT, LeftSplashOnMouseOutHandler);
            //            navSprite.addEventListener(MouseEvent.MOUSE_DOWN, LeftSplashOnPressHandler);
                        navSprite.addEventListener(MouseEvent.MOUSE_UP, LeftSplashOnReleaseHandler);
                        navSprite.mouseChildren = false;
                        navSprite.buttonMode = true;
                        LeftSplashText();
                    }
                   
                    private function LeftSplashOnMouseOverHandler(e:MouseEvent):void
                    {
                        parent_container10.removeChild(parent_container5);
                        removeChild(leftText);
                        addChild(leftSquare);
                        addChild(leftText);
                        addChild(leftText2);
                        addChild(leftText3);
                        leftText.alpha = 1;
                        leftSquare.alpha = .3;
                    }

             

                    private function LeftSplashOnMouseOutHandler(e:MouseEvent):void
                    {
                        parent_container10.addChild(parent_container5);
                        removeChild(leftText2);
                        removeChild(leftText3);
                        removeChild(leftSquare);
                        leftText.alpha = .3;
                    }

             

                    /*
                    private function LeftSplashOnPressHandler(e:MouseEvent):void
                    {
                        e.currentTarget.getChildAt(0).backgroundColor = 0xFFFFFF;
                    }
                    */

             

                    private function LeftSplashOnReleaseHandler(e:MouseEvent):void{
                            Navigate.to(e.currentTarget.getChildAt(1).text);
                    }

             

                    function RightSplash():void
                    {
                        parent_container11 = new MovieClip();
                        parent_container12.addChild(parent_container11)
                        var path2:String = "images/splashRight.png";
                        var req2:URLRequest = new URLRequest(path2);
                        var loader:Loader = new Loader();
                        loader.load(req2);
                        loader.addEventListener(IOErrorEvent.IO_ERROR, function(e:IOErrorEvent):void{ trace(e) });
                        loader.contentLoaderInfo.addEventListener(Event.COMPLETE, RightSplashLoaded);
                    }

             

                    function RightSplashLoaded(evt:Event):void
                    {
                        var loaderInfo:LoaderInfo = evt.target as LoaderInfo;
                        var displayObject:DisplayObject = loaderInfo.content;
                        displayObject.width = 504;
                        displayObject.height = 548;
                        displayObject.x = 509;
                        displayObject.y = 0;
                        parent_container11.addChild(displayObject);
                        RightSplashSquare();
                    }
                   
                    function RightSplashSquare():void
                    {
                        var square:Sprite = new Sprite();
                        var myURL:TextField = new TextField();
                        myURL.text = 'Pleasure.html';
                        myURL.x = -100;
                        myURL.y = -100;
                        var navSprite:URLClip = new URLClip();
                        navSprite.url = 'Pleasure.html';
                        navSprite.name = navName;
                        navSprite.addChild(parent_container12);
                        navSprite.addChild(myURL);
                        var len:int = myNavigation.numLines;
                        for (var i:int = 0; i < len; i++)
                        {
                            var metrics:TextLineMetrics = myNavigation.getLineMetrics(i);
                            with(navSprite.graphics)
                            {
                                beginFill(myGraphicsFill, 1);
                                drawRoundRect(myNavigation.x, myNavigation.y, metrics.width + 4, metrics.height + metrics.descent + 1, 20);
                                endFill();
                            }
                        }
                        addChild(navSprite);
                        navSprite.addEventListener(MouseEvent.MOUSE_OVER, RightSplashOnMouseOverHandler);
                        navSprite.addEventListener(MouseEvent.MOUSE_OUT, RightSplashOnMouseOutHandler);
            //            navSprite.addEventListener(MouseEvent.MOUSE_DOWN, RightSplashOnPressHandler);
                        navSprite.addEventListener(MouseEvent.MOUSE_UP, RightSplashOnReleaseHandler);
                        navSprite.mouseChildren = false;
                        navSprite.buttonMode = true;
                        RightSplashText();
                    }
                   
                    private function RightSplashOnMouseOverHandler(e:MouseEvent):void
                    {
                        parent_container12.removeChild(parent_container13);
                        removeChild(rightText);
                        addChild(rightSquare);
                        addChild(rightText);
                        addChild(rightText2);
                        addChild(rightText3);
                        rightText.alpha = 1;
                        rightSquare.alpha = .3;
                    }

             

                    private function RightSplashOnMouseOutHandler(e:MouseEvent):void
                    {
                        parent_container12.addChild(parent_container13);
                        removeChild(rightText2);
                        removeChild(rightText3);
                        removeChild(rightSquare);
                        rightText.alpha = .3;
                    }

             

                    /*
                    private function RightSplashOnPressHandler(e:MouseEvent):void
                    {
                        e.currentTarget.getChildAt(0).backgroundColor = 0xFFFFFF;
                    }
                    */

             

                    private function RightSplashOnReleaseHandler(e:MouseEvent):void{
                            Navigate.to(e.currentTarget.getChildAt(1).text);
                    }

             

                    function RightSplashCover():void
                    {
                        parent_container12.addChild(parent_container13);
                        parent_container13.graphics.beginFill(0x065566);
                        parent_container13.graphics.drawRect(509, 0, 1008, 548);
                        parent_container13.graphics.endFill();
                        parent_container13.alpha = .5;
                        Airplane();
                    }
                   
                    function Airplane():void
                    {
                        parent_container6 = new Sprite();
                        addChild(parent_container6)
                        var path:String = "images/plane2-without-prop.png";
                        var req:URLRequest = new URLRequest(path);
                        var loader:Loader = new Loader();
                        loader.load(req);
                        loader.addEventListener(IOErrorEvent.IO_ERROR, function(e:IOErrorEvent):void{ trace(e) });         
                        loader.contentLoaderInfo.addEventListener(Event.COMPLETE, AirplaneLoaded);
                    }

             

                    function AirplaneLoaded(evt:Event):void
                    {
                        var loaderInfo:LoaderInfo = evt.target as LoaderInfo;
                        var displayObject:DisplayObject = loaderInfo.content;
                        displayObject.width = 250;
                        displayObject.height = 66;
                        displayObject.x = 380;
                        displayObject.y = 250;
                        parent_container6.addChild(displayObject);
                        parent_container6.addChild(parent_container7);
                        var timeline:TimelineMax = new TimelineMax();
                        timeline.append(new TweenLite(parent_container6, 1, {}));
                        timeline.append(new TweenLite(parent_container6, 1, {x:-10, y:0}));
                        timeline.append(new TweenLite(parent_container6, 1, {x:0, y:0}));
                        timeline.append(new TweenLite(parent_container6, .2, {x:0, y:10}));
                        timeline.append(new TweenLite(parent_container6, .2, {x:0, y:-10}));
                        timeline.append(new TweenLite(parent_container6, .1, {x:0, y:0}));
                        timeline.append(new TweenLite(parent_container6, 1, {}));
                        timeline.append(new TweenLite(parent_container6, 1, {x:-20, y:0}));
                        timeline.append(new TweenLite(parent_container6, 1, {x:-20, y:0}));
                        timeline.append(new TweenLite(parent_container6, 1, {x:10, y:0}));
                        timeline.append(new TweenLite(parent_container6, 1, {x:0, y:0}));
                        timeline.repeat = -1;
                        Propeller();
                    }
                   
                    function Propeller():void
                    {
                        parent_container7 = new Sprite();
                        addChild(parent_container7)
                        var path:String = "images/prop2.png";
                        var req:URLRequest = new URLRequest(path);
                        var loader:Loader = new Loader();
                        loader.load(req);
                        loader.addEventListener(IOErrorEvent.IO_ERROR, function(e:IOErrorEvent):void{ trace(e) });         
                        loader.contentLoaderInfo.addEventListener(Event.COMPLETE, PropellerLoaded);
                    }

             

                    function PropellerLoaded(evt:Event):void
                    {
                        var loaderInfo:LoaderInfo = evt.target as LoaderInfo;
                        var displayObject:DisplayObject = loaderInfo.content;
                        displayObject.width = 44;
                        displayObject.height = 44;
                        displayObject.x = -22;
                        displayObject.y = -22;
                        displayObject.alpha = .2;
                        parent_container8 = new Sprite();
                        parent_container8.x = 505;
                        parent_container8.y = 278;
                        parent_container8.addChild(displayObject);
                        parent_container6.addChild(parent_container8);
                        var timeline:TimelineMax = new TimelineMax();
                        timeline.append(new TweenLite(parent_container8, 50, {rotation:36000, ease:Linear.easeNone}));
                        timeline.repeat = -1;
                        LoadLogo();
                    }
                   
                    function LoadLogo():void
                    {
                        parent_container = new Sprite();
                        addChild(parent_container)
                        var path:String = "images/sea-flight-logo-plus.png";
                        var req:URLRequest = new URLRequest(path);
                        var loader:Loader = new Loader();
                        loader.load(req);
                        loader.addEventListener(IOErrorEvent.IO_ERROR, function(e:IOErrorEvent):void{ trace(e) });         
                        loader.contentLoaderInfo.addEventListener(Event.COMPLETE, LoadedLogo);
                    }

             

                    function LoadedLogo(evt:Event):void
                    {
                        var loaderInfo:LoaderInfo = evt.target as LoaderInfo;
                        var displayObject:DisplayObject = loaderInfo.content;
                        displayObject.width = 300;
                        displayObject.height = 89;
                        displayObject.x = 15;
                        displayObject.y = 15;
                        parent_container.addChild(displayObject);
                        parent_container.x = 330;
                        parent_container.y = -100;
                        var myDropShadowFilter = new DropShadowFilter (10, 135, 0x000000, .5, 10, 10, 1);
                        parent_container.filters = [myDropShadowFilter];
                        TweenLite.to(parent_container, 3, {y:0});
                        LeftWhiteBg();
                    }

             

                    function LeftSplashText():void
                    {
                        var format:TextFormat = new TextFormat();
                        format.font = 'Arial Black';
                        format.size = 25;
                        leftText.textColor = 0x000000;
                        leftText.autoSize = TextFieldAutoSize.LEFT;
                        leftText.x = 50;
                        leftText.y = 60;
                        leftText.width = 200;
                        leftText.htmlText = "Business";
                        leftText.setTextFormat(format);
                        leftText.alpha = .3;
            //            var myGlowFilter = new GlowFilter (0xffffff, 1, 6, 6, 1, 1);
            //            leftText.filters = [myGlowFilter];
                        addChild(leftText);
                        var format2:TextFormat = new TextFormat();
                        format2.font = 'Arial';
                        format2.size = 18;
                        leftText2.textColor = 0x000000;
                        leftText2.autoSize = TextFieldAutoSize.LEFT;
                        leftText2.x = 50;
                        leftText2.y = 100;
                        leftText2.width = 200;
                        leftText2.multiline = true;
                        leftText2.htmlText = ":: Commuter Flights<br />:: St. Thomas - St. Croix<br />:: St. Croix - St. Thomas";
                        leftText2.setTextFormat(format2);
                        var format3:TextFormat = new TextFormat();
                        format3.font = 'Arial';
                        format3.italic = true;
                        format3.size = 18;
                        leftText3.textColor = 0x000000;
                        leftText3.autoSize = TextFieldAutoSize.LEFT;
                        leftText3.x = 200;
                        leftText3.y = 470;
                        leftText3.width = 200;
                        leftText3.multiline = true;
                        leftText3.htmlText = "(Click to enter)";
                        leftText3.setTextFormat(format3);
                        LeftSplashCover();
                    }
                   
                    function RightSplashText():void
                    {
                        var format:TextFormat = new TextFormat();
                        format.font = 'Arial Black';
                        format.size = 25;
                        rightText.textColor = 0x000000;
                        rightText.autoSize = TextFieldAutoSize.LEFT;
                        rightText.x = 780;
                        rightText.y = 60;
                        rightText.width = 200;
                        rightText.htmlText = "Pleasure";
                        rightText.setTextFormat(format);
                        rightText.alpha = .3;
                        addChild(rightText);
                        var format2:TextFormat = new TextFormat();
                        format2.font = 'Arial';
                        format2.size = 18;
                        rightText2.textColor = 0x000000;
                        rightText2.autoSize = TextFieldAutoSize.LEFT;
                        rightText2.x = 780;
                        rightText2.y = 100;
                        rightText2.width = 200;
                        rightText2.multiline = true;
                        rightText2.htmlText = ":: Island Excursions<br />:: Arial Tours<br />";
                        rightText2.setTextFormat(format2);
                        var format3:TextFormat = new TextFormat();
                        format3.font = 'Arial';
                        format3.italic = true;
                        format3.size = 18;
                        rightText3.textColor = 0x000000;
                        rightText3.autoSize = TextFieldAutoSize.LEFT;
                        rightText3.x = 700;
                        rightText3.y = 470;
                        rightText3.width = 200;
                        rightText3.multiline = true;
                        rightText3.htmlText = "(Click to enter)";
                        rightText3.setTextFormat(format3);
                        RightSplashCover();
                    }
                }
            }