5 Replies Latest reply: Mar 29, 2012 12:30 PM by Ned Murphy RSS

    Further External SWF Issues

    ngourlie

      So once again, I am trying to create seperate external SWFs for my site in order to drastically reduce load times and each SWF loads a different section of my portfolio. This code worked for the first external SWF:

       

      -----------------------------

      var myLoader:Loader = new Loader();

      var url:URLRequest = new URLRequest("flashfiles/bwphoto.swf");

      myLoader.load(url);

      bwanchor.addChild(myLoader);

       

      -----------------------------

       

      But now on a different area in the timeline when I try to use it on a different movie clip with a different SWF and URL, it doesn't work. It gives me two errors:

      1151: A conflict exists with definition myLoader in namespace internal

      1151: A conflict exists with definition url in namespace internal

       

      What do these mean? And does someone maybe just have a better code to unload and load multiple external SWFs? Keep in mind it can be just click to load, click again to unload because each SWF has its own navigation to change the image shown.

       

      Thanks again for any help.

        • 1. Re: Further External SWF Issues
          Ned Murphy CommunityMVP

          The errors seem to indicate that you are trying to declare the same variables again, namely 'myLoader' and 'url'.

           

          var myLoader:Loader = new Loader();

          var url:URLRequest ...

           

          When you use "var" you are declaring a variable.

           

          You cannot declare a variable more than once in a file.  So either use new variable names, or do not use the "var" declaration for any other times you use those variables in the file.  LAter in the timeline you could try using...

           

          myLoader = new Loader();

          url = new URLRequest("flashfiles/someother.swf");

          • 2. Re: Further External SWF Issues
            ngourlie Community Member

            When I delete the "var" I get two errors for each line:

             

            1067: Implicit coercion of a value of type flash..display:Loader to an unrelated type Class.

            1088: Illegal assignment to class Loader.

             

            I think you have a general idea of what I am trying to do though, do you maybe have a code or a link that can refer me to the code I need? Also I'm trying to understand Action Script better in general. How would I go about using "new variable names?"

             

            And I really appreciate the help so I apologize if I annoy you at any time.

            • 3. Re: Further External SWF Issues
              Ned Murphy CommunityMVP

              I'd have to see what you did for the code to try to unravel the error messages.

               

              As far as creating new variables, you just do.. that... instead of using "myLoader" and "url", you use new words...

               

              var myOtherLoader:Loader = new Loader();

              var anotherUrl:URLRequest = new URLRequest("flashfiles/bwphoto.swf");

              • 4. Re: Further External SWF Issues
                ngourlie Community Member

                Oh ok. I guess I just didn't know how to properly name variables.

                 

                Thanks again for your help Ned! Much appreciated!

                • 5. Re: Further External SWF Issues
                  Ned Murphy CommunityMVP

                  You're welcome