4 Replies Latest reply on Dec 28, 2006 9:49 AM by Sketchsta

    need help controlling Main swf, from loaded swf

    Sketchsta Level 1
      Heres the problem, im making a website which is layd out like this:
      the main.swf has MovieClipLoaders on separate frames, one for each page of the site. ( home, about, contact)

      the buttons are in Main.swf, and all the pages are loaded in Main.swf.
      now i need a link from one of the pages being loaded, to another page in Main.swf.

      from the loaded AboutUs.swf, to ContactUs button in Main.swf

      thanx.

      also... im just wondering... when im working with ALOT of text in my FLA, my comp slows down quite abit...
      is this normal?? or is my comp just slow when it comes to text??
        • 1. Re: need help controlling Main swf, from loaded swf
          injpix Level 3
          In regards to the first part of your question, are these webpages loading automatically regardless if the user clicks on the buttons in the main.swf? If not, then if the user is in the ‘AboutUs’ section of the site and wants to go to the ‘Contact’ section, just have the button direct the playhead on the main timeline to go to the contact section frame. So you would have something like this in that button’s eventhandler;

          this._parent._parent.gotoAndPlay(5);//Contact Section

          And then on frame 5 (Contact section) of the main swf, have an unloadClip() that will remove the current swf (in this example it would be the ‘AboutUs’ swf) from the MovieClipLoader instance before creating/loading the Contact.swf.

          To answer the second part of your question, yes Flash will get sluggish if you are animating text. Thankfully in Flash 8 you can set the cacheAsBitmap() to true and should see a increase in performance. Would you be perhaps scrolling these textfields that are causing this poor performance?
          • 2. Re: need help controlling Main swf, from loaded swf
            Sketchsta Level 1
            Hi myIP, thanx for the help, it works. =)

            I didnt think ._parent works on loaded swf, because i had to use _lockroot on the loaded swf.

            what you said, about unloadClip() maybe you could give me some pointers on better layouts.
            because the way im doing it now is, i have one main timeline, where all the pages are spread out on frames. and on each page i'm using a different movieClipLoader() which loads a preloader and the preloader loads the actual swf.

            there has to be an easier way to do this, and im thinking your unloadClip() is one of those ways. =)

            a final site i make looks something like this..

            index.html
            homeLoader.swf
            home.swf
            aboutLoader.swf
            about.swf
            contactLoader.swf
            contact.swf

            etc...
            i have a separate preloader for each page in the site. and a separate movieClipLoader() for each page's preLoader.
            basically, it's quite a mess. =)

            if you wanna see an example, i can give you a FLA to see the mess i work with. =P

            and "no" the textfields im working with dont animate.. i was saying when im working with the FLA inside Flash, it slows down my comp quite abit when i have alot of text on stage.
            i just have a movieClip with a big text field on it's timeline, and the only animation it does is at runtime when the user rollsOver a button, the MovieClip itself scrolls up and down.
            • 3. Re: need help controlling Main swf, from loaded swf
              injpix Level 3
              “I didnt think ._parent works on loaded swf, because i had to use _lockroot on the loaded swf.”

              The _lockroot property prevents absolute paths from the incoming swf reaching into the main swf. So if you use “_root” in the incoming swf you would want to set the _lockroot property to true. However, since the following;

              this._parent._parent.gotoAndPlay(5);//Contact Section

              …is a relative path, the _lockroot is property is not needed.

              From what you have mentioned about all of your swfs, I would recommend having a preloader that will handler all incoming swfs (homeLoader, aboutLoader, contactLoader) in the main swf. You can have this preloader called out (using attachMovie() ) from the Library when it is needed and using the removeMovieClip( ) when it is not needed. I would still use the ‘unloadClip( )’ each time you enter into a new frame in your main.swf to clear the content.

              “…it slows down my comp quite abit when i have alot of text on stage.”

              If this is the case then lower the render quality when in author-time. You can do this by navigating to the following in Flash, View> Preview Mode>Fast. This will not affect the quality of the SWF when it is compiled.
              • 4. Re: need help controlling Main swf, from loaded swf
                Sketchsta Level 1
                im affraid im not that advanced yet =)
                i dont know how to call movieClips from the library. also, the preloaders i use, have a emptyMovieClip which loads the external swf into. now if i understand you correctly, if i use removeMovieClip() after it's been loaded, then the loaded content goes with it.

                I really need to change the way i do flash sites. Your method seems a better way, but i cant use it with my knowledge right now. (which is quite limited ) =P

                Thanx for the info, i'll look into it and try to learn how i can use your method.

                and thanx for the Preview Mode Tip, that worked great. I was starting to think that my comp had something wrong with it.