3 Replies Latest reply on May 7, 2008 11:36 AM by clbeech

    Passing in movie to load via loadmovie from page

    Outside5 Ltd Level 1
      Hi all,

      My page loads a default swf using SWFObject, which in turn loads other swfs containing page content. Using SWFObject, I have non Flash content for the default page that loads if the flash player is not present.

      I would like to have each flash page replicated as an HTML page, passing the flash page to load into the default Flash page.

      For example, if the user visits mysite.com/aboutus.cfm, the page should pass in aboutus.swf as the page for default.swf to load, or if the user visits mysite.com/services.cfm, then services.swf should be passed in to the default.swf movie.

      I have tried the method shown on http://blog.deconcept.com/swfobject/, using:
      <script type="text/javascript">
      var so = new SWFObject("default.swf",
      "flash", "760", "800", "9", "#FFFFFF");
      so.addParam("wmode", "transparent");
      so.addParam("allowscriptaccess", "samedomain");
      so.addVariable("movieToLoad", "homepage_v1.swf");

      but this fails to load the movie "homepage_v1.swf" using the following in my default Flash page:
      loadMovie(_root.movieToLoad, 10);

      Any advice on where I am going wrong?

        • 1. Re: Passing in movie to load via loadmovie from page
          clbeech Level 3
          well this is kind of like doing everything 'twice' - however the main problem here appears to be that you are using a 'number' in the 'target' parameter of the loadMovie method instead of a MC (ie. 10) - if you are attempting to target a 'level' then you need to use loadMovieNum() - but using the MovieClipLoader class is much better and offers many handlers and methods that are not available when using loadMovie().

          the reason i say this is like doing everything twice is that you really only need to load that 'default' swf once - then within it you should have methods designed to load all other swf 'page' files - there's no need to navigate to another URL or cfm page -load the default again-and then load another file. this can all be done without 'reloading' the default simply by calling your loading method within the default script that contains your navigation structure and a MC 'holder' clip.
          • 2. Re: Passing in movie to load via loadmovie from page
            Outside5 Ltd Level 1
            Thank you clbeech,

            I think you may have misunderstood me (if I have not misunderstood you).

            My reasoning for doing what I am is that each flash page will have its own search engine friendly html page, for example aboutus.html. All pages will contain an html version of the site complete with links, which will be replaced by the swfobject for browsers with Flash capabilities.

            So once google (without Flash player) has indexed all my html pages, if a user clicks on the google result for about us, the aboutus.html page will load, which will then load the default Flash movie, passing in a variable telling it to load aboutus.swf as the default page. If the user clicks the result for services.html, that html page will load, which will again load the same default flash page, passing in the variable telling it to load services.swf.

            It all works when hardcoding the swf to load into the first frame as outlined in my snippet above, but does not seem to like the variable name.

            Any other ideas anyone?

            • 3. Re: Passing in movie to load via loadmovie from page
              clbeech Level 3
              lol - hey that's fine :)

              however i still believe that the problem here is the '10' in the loadMovie call - and if you are targeting level10 then you would want to use loadMovieNum() instead.

              also depending on the codes location you may not need _root.

              another though here is to run a trace on the var and see if it's getting through properly to the default swf

              just: trace(movieToLoad); previous to the the loadMovie call.