3 Replies Latest reply on Jun 15, 2006 8:40 PM by barnklad

    How To re LoadMovie and Flash 8

    barnklad
      I have Director MX 2004 with the Flash 8 Asset Xtra installed. My program is a preloaded, linked Flash 8 SWF (imported to be a cast member). It is shown on the stage as a sprite, and essentially uses Director as a shell and as a means of taking advantage of some capabilities afforded by various Xtras. My linked SWF is composed of AS2 class files that were compiled n Flash 8 Pro to make a Flash 8 SWF.

      I'm under the impression that it is possible to have this first SWF, as it runs, use loadMovie to load a local, external SWF and replace itself with that external SWF. I've already used loadMovie to load in replacement SWF from a web server, using an http:// type URL. I've also just included the second SWF as another cast member and then replaced the sprite's original member with it. That's all fine - those methods work. What I would like to do is figure out how to load in a replacement SWF using a file:/// type URL. So far, I can't do it from the file system at all, including such scenarios as placing my replacement SWF in the same folder as the Director projector. I've tried pathnames with and without spaces, and even the root of the C: drive. My loadMovie call looks like the following:

      loadMovie(targetFile, _level0, "GET");

      (with targetFile being given a value like "myFile.swf" when the file is in the projector's directory, or "file:///myFile.swf", or even a longer pathname)

      I'm aware that there are a number of sandbox issues, but again, my impression is that it is possible to set things up so that this kind of local file loading can happen in Director. Despite having already experimented with FlashPlayerTrust files, security settings within Flash's Publish Settings dialog, etc., I am still having no success.

      The visible result of my best attempts is that the original SWF appears to be exiting (leaving only its background visible), but the replacement SWF is failing to take its place and display itself. There are trace comments (up until the point of the loadMovie call) for the original SWF, but no trace comments show up from the replacement SWF.

      Also, for what it's worth, I'm noticing that tracing _root._url in my FLAs issues a strange output consisting of the path to the movie, but with letters missing and some misinterpreted characters (e.g., a hyphen in the path name). This makes me wonder if there could be some sort of communication problem in the way local paths are being communicated or resolved between/by Flash/Director.

      Anybody know how to do this? I'm thinking it should actually be easy, but I'm obviously missing something here...
        • 1. Re: How To re LoadMovie and Flash 8
          Level 7
          It is simple. I think that you may be over-thinking the problem.

          If you want to use loadMovie() from one Flash .swf in Director to load
          in another Flash .swf, then just use the relative path from the first
          .swf to the second .swf. The first .swf must be linked and not fully
          loaded into the Director movie.

          When you go to import the first .swf, be sure to set the option at the
          bottom left of the import window to "Link to External File". Then keep
          that first .swf file next to the Director movie, or in a folder, if you
          like. Be sure to not move the .swf file after you link it to the
          Director movie.

          So, if you have your Director movie, myMovie.dir and a linked Flash
          movie, flash1.swf next to that in a folder, and another Flash movie,
          flash2.swf, in the same folder, then the call to load in the second
          movie would be:

          clipName.loadMovie("flash2.swf")

          When you move all of the files to a server, or to a CD, be sure to keep
          all of files in the same relative location as they were during authoring.

          --
          Rob
          _______
          Rob Dillon
          Adobe Community Expert
          http://www.ddg-designs.com
          412-243-9119

          http://www.macromedia.com/software/trial/
          • 2. Re: How To re LoadMovie and Flash 8
            barnklad Level 1
            Hi, thank you, Rob! It helped me tremendously to have that shown to me. Upon reading your response, I became a little concerned about being able to load in SWF files from, say, an installed location or a central location on a network. But first, I simply did what you said -- and it worked first time out -- then I started fiddling with an absolute pathname, e.g.:

            clipName.loadMovie("file:///c|/myfile.swf");

            ... and it worked as well. I also tried...

            loadMovie(("file:///c|/myfile.swf", _level0);

            ...and it worked.

            What was I doing wrong? In my case, since I am working with a program that I also want to have be able to load SWFs in from a web server, I was re-using:

            loadMovie(targetFile, _level0, "GET");

            ... and specifying file URLs without success. The problem was that third param. With it present, external SWFs won't load from the local file system properly. Remove it, and bingo, you're in business!

            Seems pretty obvious in hindsight...! :-P
            • 3. Re: How To re LoadMovie and Flash 8
              barnklad Level 1
              Upon further consideration, I guess you could say it was "GET" ting in the way....! :-)