10 Replies Latest reply on Mar 1, 2011 4:47 PM by Ned Murphy

    Preloader to protect swf?

    ICPI

      Hi All,

       

      Newbee question, I have a games website and I want a preloader to protect my flash games from being downloaded easily.

      I have found heaps of preloaders that work on the time line of game but offer no protection. Does anyone know where I can get a sample code for this or where I can buy a preloader from so that it loads before the game and if someone tries to save the page they get the preloader instead of the SWF?

       

       

      A  flash designer I know said its possible but hasn't got time to create one. He gave me this code in a FLA but when I embedd the swf in to the site it doesn't load anything just displays the preloader. Im sorry this is a really novice question, been working on this project for a year + now so your advice would be really helpful to me :-).

       

      This is the code he used on the preloader he made previously

       

      function setProgress(num)

      {

          _root.percentDone = int(num);

      } // End of the function

      var methodName = "setProgress";

      var instance = null;

      var method = setProgress;

      var wasSuccessful = flash.external.ExternalInterface.addCallback(methodName, instance, method);

      this.attachMovie("root", "obj", 1);

      obj.progress.bar._xscale = 0;

      obj._y = 0;

      obj.onEnterFrame = function ()

      {

          if (_root.percentDone != undefined)

          {

              var _loc3 = Math.round(_root.percentDone);

              this.progress.bar._xscale = _loc3;

              if (_loc3 == 100)

              {

                  removeMovieClip (this);

                  delete this.onEnterFrame;

              } // end if

          } // end if

      };

      stop ();

        • 1. Re: Preloader to protect swf?
          Ned Murphy Adobe Community Professional & MVP

          What version of Actionscript is your game using?

          • 2. Re: Preloader to protect swf?
            ICPI Level 1

            Some of the games are using AS2 but a majority using AS3 or later (Have over a hundred games )

             

            Just hoping the movie/preloader can be integrated in to the game pages to start before any game starts and if some one tries to grab the game by saving the web page they will only get the loader. Do you know if I need Javascript or can I handle it in flash only?

            • 3. Re: Preloader to protect swf?
              adninjastrator Level 4

              I think that your understanding of what a preloader is may be faulty.

              A preloader really doesn't preload anything before it loads your game. A preloader would first download ALL your game unto my machine before it allows be to start playing the game. It may use a little rotating circle or something to keep me occupied. Once it reaches 100%, all the Flash assets needed to run the game (unless some assets are called later in the game) on now sitting on my machine in the Temporary Internet Files folder.... I don't have to play the game or copy the web page in order to get them. You were kind enough to include them all in the preloader...

              For protection purposes, I don't see how preloading your Flash assets contribute to that.

              Best wishes,

              Adninjastrator

              • 4. Re: Preloader to protect swf?
                ICPI Level 1

                Ok, so as I said I am a newbee hence the reason for asking-

                 

                If what I am trying to achieve isn't a preloader what would be the name given to it? How would I best protect my games is the question? I think its fair to say thats what my message clearly states.

                 

                I got the word preloader as I was playing games on another site and when I tried to grab it (for testing) I got the file which was name preloader but no game.

                 

                Look, I am not an expert but I enoy sharing advice if and when I can, If I can't or for whatever reason don't want to I just wont contribute.

                 

                Thanks in advance for those who might be able to provide useful info.

                • 5. Re: Preloader to protect swf?
                  adninjastrator Level 4

                  Oh hey, everyone can continue learning so there's no problem asking questions... I may be the one learning from your post!

                  What exactly did you mean by

                  "when I tried to grab it (for testing)"

                  Do you know how to view the actual files in your Temp Internet Files folder? If not, what operating system and web browser are you using?

                  Between all those topics we may be able to resolve this.

                  Best wishes,

                  Adninjastrator

                  • 6. Re: Preloader to protect swf?
                    ICPI Level 1

                    Thanks, thats very kind of you.

                     

                    It seems to work on XP, Vista and windows 7 and protects against all common browsers. When I say grab I mean if you go to a games website and play the game one of the simplest ways to get an swf is to file, save the webpage in firefox but I noticed with most games sites they use a "preloader" which loads before their games start (not inside the games swf) when I try to save these pages or check my temp files all I get is the movie loader/preloader but no game.

                     

                    This is what I need for my games as currently they are not secure, you can go to my website save the page and bobs your uncle, the game is there locally.

                     

                    not all of my games can be decompiled but in the interest of partners I must protect as best as I can their games from download too.

                     

                    Hope this paints a better picture

                    Thanks again

                    • 7. Re: Preloader to protect swf?
                      adninjastrator Level 4

                      To be honest I've never tried to save a Web page that way... see, I'm learning already!

                      But I do know how to check the TIF folder and trace assets from the source code.

                      Can you show me an example of a working "preloader" and one that is not?

                      Do I have to play/complete the game or just open the page?

                      Best wishes,

                      Adninjastrator

                      • 8. Re: Preloader to protect swf?
                        Ned Murphy Adobe Community Professional & MVP

                        Since you will be loading AS3 files, you will need an AS3 preloader, otherwise, an AS2 preloader such as what you showed will fail in trying to an AS3 file, which is probably what you encountered in trying it.

                         

                        Here's a link to an AS3 preloader tutorial which I believe does what you want... loads the file separately...

                         

                        AS3 Preloader
                        -------------

                        http://www.gotoandlearn.com/play.php?id=85

                         

                        but just so you aren't fooled by it all... When someone is playing your game, they have already downloaded your game.  So your protection is really only protecting your files against those who are either too lazy or lack the knowledge of how to get the file from their cache.  But some protection is often better than none.

                        • 9. Re: Preloader to protect swf?
                          ICPI Level 1

                          Thank you so much, hit the nail on the head!

                           

                          Really appreciate this.

                          • 10. Re: Preloader to protect swf?
                            Ned Murphy Adobe Community Professional & MVP

                            You're welcome