11 Replies Latest reply on Apr 29, 2010 2:19 PM by FlashRenaissance

    Can I make path from images folder to swf folder?

    FlashRenaissance Level 1

      I am using Flash CS3 and Actionscript 2.0.
      I want to make a photo.jpg that is in my images folder load into a swf that is in a swf folder. It works fine when I have the photo.jpg in the same folder as the swf. But it does not work when I have the photo.jpg in a different folder.

       

      What must I do to the AS2 to make this happen?
      I really do apprecaite an anwer to resolve this issue.

       

      Here is the path:

       

      mcLoader.loadClip("swf/images/photo1.jpg",mcHolder);

        • 1. Re: Can I make path from images folder to swf folder?
          Ned Murphy Adobe Community Professional & MVP

          Describe how the folder system is set up.  Also, if there will eventually be an html file in the mix, that will impact how you target the image as well if the swf is in a different folder than the html file.

          1 person found this helpful
          • 2. Re: Can I make path from images folder to swf folder?
            FlashRenaissance Level 1

            Hey thanks for the fast reply.

            Let me start by saying, I finally got it to load from the images folder to my swf folder with this:

             

            var mcHolder:MovieClip = createEmptyMovieClip("mcHolder", getNextHighestDepth());

            var mcLoader:MovieClipLoader = new MovieClipLoader();

            mcLoader.addListener(this);


            (mcLoader.loadClip("../images/photo1.jpg", mcHolder));   <----- this is what made it work.

             

            }

             

            However, since I uploaded it to my server it does not work.

             

             

            I have an html page that is loading on intro.swf file. This intro.swf file is loading all the other swf files into it from their own swf directory.

            I need the image jpgs to load from the images directory into the swf files within the swf directory.

             

            I know it's just a matter of simple path coding.


            So I guess the thing that will make it work online is to get my http:// in the actionscript 2.0 the correct way.

            • 3. Re: Can I make path from images folder to swf folder?
              Ned Murphy Adobe Community Professional & MVP

              When you embed/load swf files into html files, anything those files target must be aimed at as if the swf file(s) in the same folder as the html file.

              • 4. Re: Can I make path from images folder to swf folder?
                FlashRenaissance Level 1

                Ned Murphy wrote:

                 

                When you embed/load swf files into html files, anything those files target must be aimed at as if the swf file(s) in the same folder as the html file.

                I'm not sure I totally understand.

                Are you saying I must have the jpgs in the same folders as the swfs?

                Or, I must have the swfs in the same folder as the html?


                Because I am already loading the external swfs into a swf that is embeded on an html page. The intro.swf is in the same directory as the html but the swfs I am loading are in their own swf directory.

                • 5. Re: Can I make path from images folder to swf folder?
                  Ned Murphy Adobe Community Professional & MVP

                  When you load those swf's into the main swf, they now live where it lives, and because the main swf is loaded into the html page, that's where it lives (whether it is in that folder in real life or not).  The files are essentially working someplace different from where they live.

                   

                  You don't have to move anything, but you do have to target everything properly, and for swf's that get placed in an html-based home, that html-based home defines root of the relative path the swf's need to use.

                   

                  I believe you have an html that embeds an swf file in the same folder, and that swf file loads swf files from a subfolder, let's say it's called swfFolder.  And I believe the images also lie in a parallel folder to the swf's subfolder.  Then if those subfolder swf's load images from that images folder, call it imagesFolder,, then the path in those swf's to target the images would change from ../imagesFolder/  to imagesFolder/ because when they are loaded into the main swf which is loaded into the html page's folder, they essentially exist in the html page's folder

                  • 6. Re: Can I make path from images folder to swf folder?
                    FlashRenaissance Level 1

                    Ned Murphy wrote:

                     

                    When you load those swf's into the main swf, they now live where it lives, and because the main swf is loaded into the html page, that's where it lives (whether it is in that folder in real life or not).  The files are essentially working someplace different from where they live.

                     

                    You don't have to move anything, but you do have to target everything properly, and for swf's that get placed in an html-based home, that html-based home defines root of the relative path the swf's need to use.

                     

                    I believe you have an html that embeds an swf file in the same folder, and that swf file loads swf files from a subfolder, let's say it's called swfFolder.  And I believe the images also lie in a parallel folder to the swf's subfolder.  Then if those subfolder swf's load images from that images folder, call it imagesFolder,, then the path in those swf's to target the images would change from ../imagesFolder/  to imagesFolder/ because when they are loaded into the main swf which is loaded into the html page's folder, they essentially exist in the html page's folder

                    Hmmm so should I make mcLoader.loadClip("swf/images/photo1.jpg",mcHolder); this mcLoader.loadClip("images/photo1.jpg",mcHolder);

                    • 7. Re: Can I make path from images folder to swf folder?
                      Ned Murphy Adobe Community Professional & MVP

                      I honestly can't answer that.  I still don't know for sure what your folder structure is.

                      • 8. Re: Can I make path from images folder to swf folder?
                        FlashRenaissance Level 1

                        Okay here it goes.

                         

                        I have an html page. Within that html directory is a intro.swf

                        That intro.swf is loading a photography.swf that is located in the swf folder directory.

                        Within that swf folder directory photography.swf is loading an external photo called photo1.jpg. That photo1.jpg is in an images folder.

                         

                        So we have

                         

                        intro.swf

                        embedded in

                        html

                         

                         

                        ahh forget it.

                        • 9. Re: Can I make path from images folder to swf folder?
                          FlashRenaissance Level 1

                          I think I found the problem. I can get the jpgs to load into the photograph.swf files fine.

                          But this is what happens. When I click on those buttons in photoshop.swf THROUGH THE MAIN.SWF they don't know up. So, the problem lies within me trying to get the photograph.swf to work through main.swf. That's the problem. Any suggestion on how to fix that?

                          • 10. Re: Can I make path from images folder to swf folder?
                            Ned Murphy Adobe Community Professional & MVP

                            I'll just be repeating what I've already said.

                            • 11. Re: Can I make path from images folder to swf folder?
                              FlashRenaissance Level 1

                              I ended up putting all the files in the same directory. Now everything loads. I just have to get some sort of preloader for the images and I'm set to go.