3 Replies Latest reply on Dec 19, 2006 9:11 AM by Ricalsin

    Loading swf into movie clip; button controlled

      Ouch, I'm hurting on this simple topic - though I've learned a lot durig the search phase (newbie);

      I put this code in frame 1 of the my "action" layer:

      this.createEmptyMovieClip("serOver_mc", 1);
      var mclListener:Object = new Object();
      mclListener.onLoadInit = function(target_mc:MovieClip) {
      trace("movie loaded");
      var image_mcl:MovieClipLoader = new MovieClipLoader();
      image_mcl.loadClip("rtmMovie.swf", serOver_mc);

      "serOver_mc" is a movieClip instance placed on the timeline 10 seconds or so down the road. My hope was to control the .swf play by a button. Instead, it launches as soon as the main timeline begins.

      Also, I was hoping to play the .swf at (x = 560, y = 2.5) which is where the serOver_mc was placed. I was only able to make this .swf location happen by publishing my .swf in a document that matches the flash file I'm trying to play the .swf in (at x = 560, y = 2.5). (Did I say that clearly? In other words, when the 0,0 coordinates line up my swf video is at 560,2.5). But this kind of proves to me I don't really have it in the serOver_mc and might also explain why I'm not able to control its playback.

      I'm thinking this is pretty simple., but I am lost. (Does that make me a loser?)

        • 1. Re: Loading swf into movie clip; button controlled
          kglad Adobe Community Professional & MVP
          do you have more than one movieclip named serOver_mc? one that you created in the authoring environment and one that you create with the first line of your code?

          if so, that would cause the problems you describe.
          • 2. Re: Loading swf into movie clip; button controlled
            The Feldkircher Level 2

            One thing to remember when loading a swf into a container is that the swf takes the coords of the container and not the screen.
            Therefore the top/left of the container will be 0,0. To ensure your alignment is correct, always make the content with the reference top left.

            Hope it helps
            • 3. Re: Loading swf into movie clip; button controlled
              Ricalsin Level 1
              Kglad, The Feldkircher: Thanks.

              Accepting that the swf "takes the coords of the container" made the positioning issue solveable for me.

              I got control of the playback issue by simpling placing the line: "image_mcl.loadClip("rtmMovie.swf", serOver_mc); at the point of desired playback (inside an "on(release)" function. I know this works on my computer, but is it correct for deploying over a website.

              My goal was to have the swf download and be ready for playback when the user came to the button that will launch it. Does "onLoadInit()" accomplish the download to the users computer, and then "loadClip()" launches the playback? Or are my users going to be waiting for this 100k download (a good percentage of my audience is on 28K modems) when they push the button to play it? That's 20 seconds of wait time I could avoid if I wrote the code correctly.

              Thanks for the help.