2 Replies Latest reply on Apr 18, 2006 8:55 AM by ropeGun

    Controlling SWF loaded through MovieClipLoader

    ropeGun
      Hello AS gurus,

      I have a two-level site for a portfolio where users can view still images and videos for different projects. The top level SWF file can be considered as the "parent SWF" and within this file, the user navigates by choosing which project he/she wants to explore. After choosing, the "parent SWF" loads in a "child SWF" via MovieClipLoader of the selected content. It is within this "child SWF" that the user can view the various images and videos (with sound) of the selected project. To go back out and choose a different project, the parent SWF is used and the user navigates to and chooses another project.

      The problem is that I can't figure out how to communicate from the child SWF to the parent SWF (and vice versa)...well not really...this is difficult to explain...hmmm... It would be better to explain it with an example...

      If you go to: http://www.culshaw.info/junk_drawer/xdin/swf/

      (1) Choose the "Examples" square (when this box zooms up, you are presented with a way to navigate to various projects -- this SWF that loads as the zoom up happens is what I am calling the "parent SWF").
      (2) Choose the second project, labelled "Ford : Ti-VCT" by clicking on it (after clicking on the Ford project, the "child SWF" is loaded via a MCL from the "parent SWF").
      (3) You can see that the Ford project has 8 images and one video that the user can view. Choose the video and ensure that it begins to play and hit the mute button so that you hear sound (sound is default muted. It is within this "child SWF" that the video is NetStream(ed) and the sound is controlled. (there is a bug with my code here so you may need to hit play/pause to get the video going).
      (4) Now, as the video is playing and you hear sound, click on the "Other Examples" button that is located below the video player. This button is actually embedded in the the "parent SWF" that allows the user to navigate back up to see other projects and not in the "child SWF" which contains all of the content. Notice that you continue to hear the sound and that the net connection is still streaming the video within the "child SWF". I don't want this to happen. I want the "parent SWF" to tell the "child SWF" to stop streaming and stop all sounds when this "parent SWF" - embedded "Other Examples" button is pushed.

      I can't figure out how to do this. Any info that may help would be appreciated...

      -john
        • 1. Re: Controlling SWF loaded through MovieClipLoader
          NS5 Level 1
          Hi,

          It looks to me that the example you are going by has a main navigation in the parent swf that is controlling which child movie is loaded in and each child swf has its own internal navigation. If this is what you are trying to achieve and you are using _root.MoveClipName to target things you need to use the lockroot code so the flash player knows what root you are talking about.

          Place on the first frame of each Child swf
          this._lockroot = true;

          Hope this helps
          • 2. Re: Controlling SWF loaded through MovieClipLoader
            ropeGun Level 1
            NS5,

            Thanks for the suggestion, but alas, it will not work for me unless I make a major overhaul of my system. From what I was told it is bad form to use "_root." when refering to elements in a SWF (especially when calling/loading SWF's from one into another), so I use only "this." throughout.

            I was hoping for a solution that allows for SWF's to communicate to each other.

            Thanks for yout time and effort, in any case...

            -john