4 Replies Latest reply on Jul 24, 2010 10:18 AM by kglad

    How to play a .swf Movie in another project after every 10 seconds?

    learner_7n Level 1

      Hi,

       

      I have a Logo.swf file which play once and stops. I want to use this flash movie in another flash project using LOADER. What actually I need is, I want to play this movie every 10 seconds interval using Actionscript 3. How cant I? Please help.

       

      Thanks.

        • 1. Re: How to play a .swf Movie in another project after every 10 seconds?
          kglad Adobe Community Professional & MVP

          on the last frame of Logo.swf use:

           

          stop();

          this.visible=false;


          var t:Timer;


          if(t==null){

          t=new Timer(10000,0);

          t.addEventListener(TimerEvent.TIMER,f);

          t.start();


          function f(e:TimerEvent):void{

          this.visible=true;

          this.gotoAndPlay(1);

          }

          }

          1 person found this helpful
          • 2. Re: How to play a .swf Movie in another project after every 10 seconds?
            Deepanjan Das Level 3

            Hi,

            There may be 2 scenarios for this:

            1. The logo animation in the logo.swf is within a movieclip and has a stop() function called in the last frame.

            Solution:

            import flash.display.Loader;
            import flash.display.LoaderInfo;
            import flash.events.*;
            import flash.net.URLRequest;

             

            var logoSWF:MovieClip;
            var timer:Timer = new Timer(1000);
            timer.addEventListener(TimerEvent.TIMER, playLogo);

             

            function loadLogo() {
                var url:String = "logo.swf";
                var loader:Loader = new Loader();
                loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
                loader.load(new URLRequest(url));
            }

             


            function completeHandler(event:Event):void {
                timer.start();
                var loader:LoaderInfo = LoaderInfo( event.currentTarget );
                logoSWF = MovieClip( loader.content );
                addChild(logoSWF);
            }

             

            function playLogo(event:Event=null):void {
                logoSWF.logo.play(); //"logo" is the instance name in logo.swf
            }
            loadLogo();

             

             

            2. The logo animation in the logo.swf in in the main timeline and has astop() function in the main timeline.

            Solution:

            import flash.display.Loader;
            import flash.display.LoaderInfo;
            import flash.events.*;
            import flash.net.URLRequest;

             

            var loader:Loader;
            var timer:Timer = new Timer(1000);
            timer.addEventListener(TimerEvent.TIMER, playLogo);

             

            function loadLogo() {
                var url:String = "logo1.swf";
                loader = new Loader();
                loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
                loader.load(new URLRequest(url));
            }

             


            function completeHandler(event:Event):void {
                timer.start();
                var loader:LoaderInfo = LoaderInfo( event.currentTarget );
                addChild(loader.content);
            }

             

            function playLogo(event:Event=null):void {
                MovieClip( loader.content ).play();
            }
            loadLogo();

             

            ///////////////////////////////////

             

            Hope this helps.

             

            Warm Regards

            Deepanjan Das

            http://deepanjandas.wordpress.com/

            • 3. Re: How to play a .swf Movie in another project after every 10 seconds?
              learner_7n Level 1

              Hi,

               

              Thanks for your immediate help. It is quite nice now.

               

              Regards.