10 Replies Latest reply on Jun 6, 2011 8:33 AM by Ned Murphy

    Load transparent swf

    pantelis224466

      Hi there.

      I have a .swf in which i load html content through xml file.

      I want o load this .swf in my main.swf, which i do by creating a container.

      I want the loaded .swf to be transparent.

       

      Can i do this?

        • 1. Re: Load transparent swf
          Ron Colmen Level 2

          remove the background from your fla and publish it to swf. then try loading it.

          • 2. Re: Load transparent swf
            Ned Murphy Adobe Community Professional & MVP

            What do you mean when you say you want it to be transparent?  I have to ask because it means different things to different people.

            • 3. Re: Load transparent swf
              pantelis224466 Level 1

              In the .swf that i load html content through xml i use a rectangular in which i load the content and the background color is white.

              I have converted this rectangular to Symbol and i have reduced its Alpha so that it appears transparent (with reduced aplpha).

               

              When i load this swf to main.swf i want this to have reduced alpha so i can see the background that is on main.swf

              • 4. Re: Load transparent swf
                Ron Colmen Level 2

                give your symbol an instance name (bg_mc).

                on the main fla put

                _root.movieclipInstanceWhichYouLoadedSwf.bg_mc._alpha = 0

                1 person found this helpful
                • 5. Re: Load transparent swf
                  Ron Colmen Level 2

                  You might need to use onEnterFrame();

                  • 6. Re: Load transparent swf
                    Ned Murphy Adobe Community Professional & MVP

                    I'm not clear on where this reduced alpha white rectangle is, but if it is inside the file that you are loading, then it should not be affected and should show up as you intend it to.  If the rectangle is in the main file and you are loading the external swf into that rectangle movieclip, then what happens is the container content is replaced by the loaded content. It is not added to what's already in the container, but instead replaces whatever is inside it.

                    • 7. Re: Load transparent swf
                      pantelis224466 Level 1

                      The rectangle is in my external swf (in which i load the html content through xml). I load the html content in a rectangle. I have converted this particular rectangle into movieclip and changed its alpha into 50%. The background is white. So, when i check this .swf i can load the content on the rectangle  which is transparent(with reduced alpha).

                      This whole .swf is loaded at the main.swf by the method:

                       

                      var loader:MovieClipLoader = new MovieClipLoader();
                      this.createEmptyMovieClip("myGalleryContainer",1);
                      myGalleryContainer._lockroot=true;
                      loader.loadClip("htmlcontent.swf",myGalleryContainer);

                       

                      At the main.swf i have a background slideshow. I want, when the external swf described before loads in the main.swf with the transparency i described.

                       

                      Its like saving the first swf without background color (like a .png file) so with the transparency of the rectangle you can see the background slideshow of the main.swf.

                       

                      I gave my rectangle movieclip instance name bg_mc and then at main.swf i wrote:

                       

                      //Loads the external html-content .swf file in the main

                      var loader:MovieClipLoader = new MovieClipLoader();
                      this.createEmptyMovieClip("myGalleryContainerhtmltext",2);
                      myGalleryContainerhtmltext._lockroot=true;
                      loader.loadClip("content_page.swf",myGalleryContainerhtmltext);
                      myGalleryContainerhtmltext._y =30;
                      myGalleryContainerhtmltext._x =2;
                      onEnterFrame(_root.content_page.swf.bg_mc._alpha = 50);

                      but nothing happens.

                      I tried this without onEnterFrame(); and still the same

                      • 8. Re: Load transparent swf
                        Ned Murphy Adobe Community Professional & MVP

                        Using the onEnterFrame that way is incorrect, and for what you are trying to do, it is incorrect and inefficient to use it at all.

                         

                        My first suggestion would be to manage the alpha value of the bg_mc within the swf file it is in, not externally from the main swf.  Just set its alpha to whatever reduced value you intend via the properties panel.

                         

                        If there is some reason you need to change its alpha from the other swf, then you need to wait until the file is loaded before you can do that.  Since you are using the MovieClipLoader finction to load the swf, you are one step closer to being able to detect when the file has loaded.  Look up the MovieClipLoader.addListener() method for an example of how to detect when a file has finished loading.

                        1 person found this helpful
                        • 9. Re: Load transparent swf
                          pantelis224466 Level 1

                          I changed the alpha color to 20% without converting the rectangle to movieclip and i get the result i want!

                           

                          Thank you very much for your help!

                          • 10. Re: Load transparent swf
                            Ned Murphy Adobe Community Professional & MVP

                            You're welcome