8 Replies Latest reply on Jul 21, 2010 1:57 PM by philliptackett7

    fla variables and URL path location

    philliptackett7

      Hi,

       

      I have a fla file and in that fla it combines a few movies into one swf. I inherited this code and now I'm converting a website which uses the swf to a CMS system.

       

      My swf no longer works because the file path is different in the new site than the old one. My question is how can I create a path that is relative to the root in a variable?

       

      I have some code which I found:

       

      filename = ["bio_1.swf", "bio_2.swf", "bio_3.swf", "bio_4.swf"];
      path = "fla/";
      i = filename.length;
      k = Math.floor(Math.random()*i);
      loadMovie(path+filename[k], loadInto);

       

      As you can see the 4 files bio_1.swf, bio_2.swf etc. are combined and made into the loadMovie. But my issue is the path = "fla/". I want to make this more 'flexible'.

       

      Can anybody help me with this?

       

      Thanks,

      Phil

        • 1. Re: fla variables and URL path location
          kglad Adobe Community Professional & MVP

          it can't be much more flexible.  you're using a variable (path) to reference the path to your files.

           

          path can be any string so there's no more flexibility needed.

          • 2. Re: fla variables and URL path location
            philliptackett7 Level 1

            Is there something I can set the 'path' equal to so that no matter where the swf is on the web server it will work when being called from a webpage?

             


            Thanks,

            Phil

            • 3. Re: fla variables and URL path location
              kglad Adobe Community Professional & MVP

              no.

               

              on the other hand it's not required that path be hard-coded.  you could for example have a program (eg, php) that detemines the value of path and passes that to flash.

              • 4. Re: fla variables and URL path location
                philliptackett7 Level 1

                Being new to flash and all.. Would I change the code in this section or is there another place to do it?

                 

                 

                filename = ["bio_1.swf", "bio_2.swf", "bio_3.swf", "bio_4.swf"];
                path = "fla/";
                i = filename.length;
                k = Math.floor(Math.random()*i);
                loadMovie(path+filename[k], loadInto);

                 

                I don't suppose you could provide an example? I know how to find the base path in Drupal

                 

                 

                • 5. Re: fla variables and URL path location
                  kglad Adobe Community Professional & MVP

                  from what i know, you want to change the value of path.  you might also want to change the swf names in the array filename.

                   

                  you can define them when and where you want as long as their defined before you try and use them.

                   

                  the path to your loaded swfs is relative to the html file that embeds your main swf.

                  • 6. Re: fla variables and URL path location
                    philliptackett7 Level 1

                    If the files are relative to the main swf for the bio_1.swf etc. then why do we even need the path at all? I'm putting the files in the same folder. At any rate, my swf kinda works now. I'm calling it in my home page like this:

                     

                    <object>
                    <param name="movie" value="<?php print base_path() . path_to_theme() ?>/fla/psm_index.swf" /> <embed height="385" width="958" src="<?php print base_path() . path_to_theme() ?>/fla/psm_index.swf"></embed> 
                    </object>

                     

                    Unfortunately the 'bio_1.swf' do not load. The main swf does though. I had it working before and I'm not sure why it doesn't work now.

                     

                    filename = ["bio_1.swf", "bio_2.swf", "bio_3.swf", "bio_4.swf"];
                    //path = "./";
                    i = filename.length;
                    k = Math.floor(Math.random()*i);
                    loadMovie(filename[k], loadInto);

                     

                    Giving up soon

                    • 7. Re: fla variables and URL path location
                      kglad Adobe Community Professional & MVP

                      the files aren't relative to the main swf.  they're relative to the html that embeds the main swf.

                       

                      in any case, if all your files are in the same directory, you can use

                       

                      path = "";

                       

                      and don't edit your html file unless you understand what you're doing.  let flash create your html file and use it.

                      • 8. Re: fla variables and URL path location
                        philliptackett7 Level 1

                        I was able to get the video working by moving the folder with the swf into the Drupal root. This isn't the ideal solution, but there's something in the swf that wants the file location to be in the root. I'm not sure how to make it so that I can move the folder someplace else.

                         

                        All my files are in the same directory and I just took out the path part all together.

                         

                         

                        Thanks,

                        Phil