6 Replies Latest reply on May 30, 2011 2:53 PM by kglad

    Reference to External SWF

    Mark Richardson

      Hi guys,

      I'm new round here so sorry to open with a question. Flash isn't my area  of expertise at all, but if anyone needs help with Photoshop or Joomla  then I might be able to help!

      Anyway - my problem.

      I had a SWF which interacts with a component SWF. I want to remove the  component and replace it with an external SWF. I've created a SWF which  contained only the component.

      I'm then loading that using the following AS2 code:

      Code:
      _root.createEmptyMovieClip("my_ssp", 1);
      container._x = 0;
      container._y = 0;
      loadMovie("slideshowpro.swf", "my_ssp");

      I'm then trying to reference this SWF using code like:

       

      Code:
      my_ssp.addEventListener("onAlbumData", listenerObject);

      This code works when there is a component called my_ssp so I  assume that it is just the way I'm referencing the external SWF that is  the problem.



      Any help would be appreciated!
        • 1. Re: Reference to External SWF
          kglad Adobe Community Professional & MVP

          the word "component" has a very specific meaning when discussing flash.  it's not clear you're using that term correctly.

           

          it's also not clear what you're trying to do with that listener but whatever it is, that part is probably incorrect and unlikely to work the way you want.

           

          other than that, if you're loading an external swf (eg, slideshowpro) into a target movieclip (eg, my_ssp), you can reference the loaded swf (WHEN LOADING IS COMPLETE) by using my_ssp.

          1 person found this helpful
          • 2. Re: Reference to External SWF
            Mark Richardson Level 1

            Thanks for that.

             

            I think as I read your answer I realised what my issue is.

             

            As my terminology may be wrong let me explain what I'm doing.

             

            I have a parent swf with various code referencing a component I inserted with an instance name my_ssp.

            I want to have that component as part of an external swf. So I created a new  swf which contains just the component with an instance name of my_ssp.  I've then loaded that new swf into the parent swf with an instance name  my_ssp.

             

             

            I think what I need to do is to reference the component within that swf - would loading the external swf with an instance name of extswf, and then referencing extswf.my_ssp work?

            • 3. Re: Reference to External SWF
              Mark Richardson Level 1

              Sorry - meant to also say that the line of code I listed for the listener works when the component is inserted directly into the parent SWF - so I assume it's just the referencing of the component in the external SWF that is the issue.

              • 4. Re: Reference to External SWF
                kglad Adobe Community Professional & MVP

                by component, do you mean a precompiled movieclip?   (it's very unlikely a novice flash user would create a component.  i've create hundreds of projects and have never created a component.)

                 

                with as3 (that's a typo - should read, with as2), you cannot reparent an object.  so, if an object is a child of some timeline, you cannot reparent it to another timeline (external swf or otherwise).

                 

                if you have an object in your library set to export for actionscript, that can be parented to any timeline (including a loaded swf's main timeline or any other timeline in the loaded swf).

                1 person found this helpful
                • 5. Re: Reference to External SWF
                  Mark Richardson Level 1

                  The component is a commercially available precompiled SWF (which allows you to set various parameters).

                   

                  I'm using AS2 so I don't think your point about AS3 is relevant.

                   

                  I'm slightly confused about your point about "an object in your library set to export for actionscript". Do I need to specifically export for actionscript (as a specific step beyond exporting it as a SWF?

                  • 6. Re: Reference to External SWF
                    kglad Adobe Community Professional & MVP

                    I have a parent swf with various code referencing a component I inserted with an instance name my_ssp.

                    1a.  what is the component?

                    1b.  where is the component?  is it in the parent swf's library?  is it on-stage in the parent swf?

                     

                     

                    I  want to have that component as part of an external swf. So I created a  new  swf which contains just the component with an instance name of  my_ssp.  I've then loaded that new swf into the parent swf with an  instance name  my_ssp.

                    2a.  my_ssp is the target movieclip used in your loadMovie() function and nothing else, correct?

                    2b.  you want to add "something" from the parent swf to to the loaded swf, correct?

                    2c.  you're calling that "something" a component, correct?

                    1 person found this helpful