5 Replies Latest reply on Aug 12, 2006 8:03 AM by kglad

    External swf keeps reloading

    calpolyarc
      I've got an external swf that I load into a movie clip using:

      loadMovie("Projects.swf", _root.ProjectsBox);

      I could swear that when I first created this website the swf would load in the background as you looked at other areas of the site, and if you clicked on the button that takes you to the scene that contains the ProjectsBox movie clip then you would see the swf already partially loaded (it has a loading bar) or it would be done loading and you could 'use' it. Now, however, each time you go to that scene that contains the MC it starts the loading of the swf over, from 0%.

      In my main movie I have the

      loadMovie("Projects.swf", "_root.ProjectsBox");

      at the end of my preloader, where the site sits and waits for you to push something. I also have that line of code in the first frame of the scene in which I want the swf to 'play'. This is most likely causing the swf to reload every time this scene is brought up, but without it there it doesn't show up at all.

      Here is the site: http://www.csa-arch.com/

      The area in questions is "Projects"

      Help!
        • 1. Re: External swf keeps reloading
          kglad Adobe Community Professional & MVP
          you should only execute your loadMovie() statement once. if that statement is in a frame that plays more than once, you'll need to add some code to prevent the loadMove() from re-executing:

          • 2. Re: External swf keeps reloading
            calpolyarc Level 1
            That makes sense to me, but then why doesn't the external swf show up in my Projects scene, where I have the same MC (with same instance name) as I do in the preloader where the initial loadMovie is executed?

            The loadMovie is on the same frame as the first instance of the MC (diff layers not that it matters), as well as a stop();

            Along with the loadMovie I have:
            setProperty(_root.ProjectsBox, _x, 2000);
            setProperty(_root.ProjectsBox, _y, 2000);

            Without those, the external swf appears before it's 'time'. Crude way of making it not appear I know.... Then you click on the Projects button and the MC should be back in it's correct x and y location. When I do a trace in the Projects scene the x and y are correct and the MC is at Level0.

            Thoughts?
            and Thanks....
            • 3. Re: External swf keeps reloading
              kglad Adobe Community Professional & MVP
              your swf will appear as long as _root.ProjectsBox exists (and the path/file name to Projects.swf is correct).

              because you mentioned something about the "Projects scene" i'm guessing that you have more than one scene. if the playhead moves from one scene (that contains _root.ProjectsBox placed in the authoring environment) to another scene, _root.ProjectsBox will no longer exist in the new scene even if you add another movieclip by the same instance name to this scene.

              if you create your target movieclip using actionscript (ie, _root.createEmptyMovie
              Clip("ProjectsBox",1), then your target movieclip will exist no matter what blank keyframes are encountered by the playhead after the target movieclip is created.
              • 4. Re: External swf keeps reloading
                calpolyarc Level 1
                quote:

                because you mentioned something about the "Projects scene" i'm guessing that you have more than one scene. if the playhead moves from one scene (that contains _root.ProjectsBox placed in the authoring environment) to another scene, _root.ProjectsBox will no longer exist in the new scene even if you add another movieclip by the same instance name to this scene.
                - hit the nail on the head.


                ok I had never heard of the createEmptyMovieClip before. I'm not a full time Flash user, just an employee creating the company website... With that said, here is my new code:

                createEmptyMovieClip("ProjectsMC", this.getNextHighestDepth());
                projectsMC.loadMovie("Projects.swf")
                //setProperty(projectsMC, _visible, false);
                ProjectsMC._x = 2000;
                ProjectsMC._y = 2000;

                The projectMC._visible = false does not make the "Projects.swf" invisible, therefore had to resort to the large x & y values to get it off the screen. Then when I do want it to show up I just enter the 'correct' x and y values. So it works fine however I'm sure there is a more elegant (or appropriate) way of accomplishing this?? Is it a depth issue, I tried level0, 1, 2 and 200000. I even tried the getnextHigherdepth thing?? I have 3 other external swf's I need to load and would rather script there visibilty/invisibility correctly.

                Thanks Kglad
                • 5. Re: External swf keeps reloading
                  kglad Adobe Community Professional & MVP
                  the issue you are now encountering is that some properties for ProjectsMC are preserved after loading and some properties are reset (to their default values). as you've seen, the _x and _y properties are preserved and the _visible property is not.

                  the _alpha property is preserved so, in your situation, you could set the _alpha of ProjectsMC to zero before loading is complete (or even started) and your external swf will inherit that _alpha when loading is complete. you can then set the _alpha to 100 when you want your swf to be visible.