8 Replies Latest reply on Oct 9, 2007 7:31 AM by clbeech

    External text won't load

    egoldin
      Hi all,
      I'm sorry if this is subject posted twice. I tried to improve my original description of the problem, and

      I have two swfs, a Master file and an About file. As swfs, the About file is loaded into the master swf through a movie clip loader. In the about file, I want to load external text into a text box. The problem is, when the text box is located INSIDE of a movie clip, it doesn't work. And I need it to work, because I want the text to load at certain point during the movie clip. To load the text, I use this code in frame 1 of master.swf:

      // -------- <load vars> ------ \\
      var myLV:LoadVars = new LoadVars();

      myLV.onLoad = function (success:Boolean) {
      if (success) {
      _level5.loadedInfo.htmlText = myLV.info;
      } else {
      _level5.loadedInfo.text = "There has been an error loading the requested information.";
      }
      }
      // -------- </load vars> ------ \\

      And in frame 1 of about.swf:

      _level0.myLV.load("vars/about.txt");

      You can download my FLAs and text file at goldinroute.com/macgregor/help.zip

      Click on "About" in the menu. See how that one text box appears (the one that's way out of place) yet nothing else appears? The working "dummy" text box has the same instance name as the other, but the other is inside of the "boxmovie" movie clip, while the dummy box is located on the About stage. Ideas? Help would be VERY much appreciated. I've been pounding my head against a wall for about 2 days now.
      - Evan
      quote:

      Text
        • 1. Re: External text won't load
          robdillon Most Valuable Participant
          1. You have the wrong .swf referenced in the loadClip function it should read:

          myMCL.loadClip("about.swf",...

          additionally, you are just loading this clip into a level. By doing that you then have no reference for it when you want to load the text. Add a line like this to the top of that code in master.fla:

          var container:MovieClip = createEmptyMovieClip("container", getNextHighestDepth());

          Now you have a reference point for that loaded clip. So use that in your loadClip function, like this:

          myMCL.loadClip("about.swf",container);

          Your clip will load. To get the text to load in, use:

          container.loadedInfo.htmlText = myLV.info in your onLoad function.
          • 2. External text won't load
            clbeech Level 3
            @ egoldin: did you see the other post? all you need to do is move the LV code to the end of the about.swf inside the boxmovie MC and load it there.

            EDIT: ok I see that you did, and I didn't respond, sorry. did you change the paths in the LV code to reflect the new loaction or did you leave them the way they were?
            • 3. Re: External text won't load
              clbeech Level 3
              you also need to set the 'htmlText' property to true in the properties panel, and embed the text in the field.

              on frame 23 it should read:
              • 4. Re: External text won't load
                egoldin Level 1
                It worked, IT WORKED!!!!! You guys have no idea how long I've been struggling with this. I think it was actually Cbeech's last tip that made the difference.

                Rob: That splash.swf wasn't the wrong swf i was referencing, that was the splash animation and navi menu that is loaded in. I tried your suggestion originall,y but it was removing the _level5 that made the difference, along with embedding the text. This isn't a big deal, as I can proceed on the project replicating the current method, but is it better to have the code located in the master.swf file somehow so that it can be used by any swf I load in?
                • 5. Re: External text won't load
                  clbeech Level 3
                  You could make it into a function at the root level and pass a parameter to the function that would load whatever your calling, yes that's possible, and will make your system more dynamic, but you'll need to remember to keep your paths straight.

                  Try this: comment out the code you have now in the boxmovie mc, then place the function I'll write below, and then add the bottom line to frame 23 (without acing the code that's working just comment it out for a test)

                  • 6. Re: External text won't load
                    egoldin Level 1
                    Cbeech,
                    Sorry for the delay. I just finished a few celebratory laps around the block. However, there's one last thing I need help with. I'm still having trouble referencing objects within movie clips (if you want to give me some pointers on that, it would be very welcome). As you probably saw, I want to have some submenu optiosn on the left side of that cream-colored box. I'd like these buttons to change the text in the box — essentially changing the file the text box is loading from. However, I'm running into the same problem — not being able to reference items that are located inside the movie clip. I thought it would be simple as placing this on the About.swf stage:

                    btn_about2.onRelease = function () {
                    _level0.loadText(loadedInfo, 'vars/about2.txt');
                    }

                    But with that code, the "More" text box still doesn't seem to be turning into a button or having this desired functionality. What am I doing wrong?
                    - Evan
                    • 7. Re: External text won't load
                      robdillon Most Valuable Participant
                      Yes, you can place the actionscript in the first movie and then use it from other movies that you load in.
                      • 8. Re: External text won't load
                        clbeech Level 3
                        Thanks Rob, I'd answered this in another semi-duplicate posting by egoldin :)