9 Replies Latest reply on Dec 16, 2006 3:52 PM by kglad

    Preserve frame rate when loading one swf into another

      Is there a way to preserve the frame rate of a swf when loading it into another swf that plays at a higher frame rate. I'm loading some flash ads that mostly run at around 12-15 frames a second into a portfolio site that runs at around 40 frames per second. All my ads play too fast. The link is:

      www.dg8tal.com/portfolioidea.html

      Thanks!

        • 1. Re: Preserve frame rate when loading one swf into another
          Generave
          As far as I understand it, there is no option to override the frame rate designated by the main movie you are loading into. The SWF file you are loading always inherits the framerate of the SWF you are loading it into. Here are some suggested work-arounds that might help:

          1) Lower the frame rate of the main movie on the website that you are loading into.
          2) Expand the timelines of the advertisements just for use in your portfolio
          3) Put your menu and thumbnails in one HTML frame that can then load each item in another HTML frame above it. Since each SWF would load on its own, the framerate of your main swf would not matter. You would lose your nice resizing effect though unless you did some more complicated integration with javascript I imagine.

          I would recommend going with option 2, since that will take the smallest amount of work while preserving your overall design. However, with the faster framerate, your advertisements would have difference performance characteristics that you'll need to assess.

          I'm trying to think of more options, but these seem to be the first things that come to mind.
          1 person found this helpful
          • 2. Re: Preserve frame rate when loading one swf into another
            kglad Adobe Community Professional & MVP
            you can use the code below the dotted line to play (and stop) any movieclip from frame m to fram n at any framerate (fps) the host computer can manage:

            • 3. Re: Preserve frame rate when loading one swf into another
              A couple questions:
              One: I get this error message:
              **Error** Scene=Scene 1, layer=Layer 20, frame=1:Line 10: Left side of assignment operator must be variable or property.
              MovieClip.prototype.playF = function(m, n, fps) {

              And two: I am using this for each of my menu items when they are clicked:

              if (this._parent.menuNum == 0 && foldername == "photos/") {
              bigboxresize();
              _root.box.boxMovieHolder.loadMovie("ads/skins.swf")
              }

              Since I am loading a swf into a container movieclip named "boxMovieHolder"......where would I apply the method:

              mc1.playF(m,n,fps) .....which i guess would be _root.box.boxMovieHolder.playF(2,3,12).........or something like that
              • 4. Re: Preserve frame rate when loading one swf into another
                Oh, and thanks a ton! I'm sure I can use this for a lot of applications!
                • 5. Re: Preserve frame rate when loading one swf into another
                  kglad Adobe Community Professional & MVP
                  if you're still getting that error message, post a link to your fla.

                  you would apply the playF() method to your target movieclip AFTER loading is complete.
                  • 6. Re: Preserve frame rate when loading one swf into another
                    Wow. I've heard other people tell you that you are amazing, and now i confirm. I'm pretty sure I got your code working in my script. My movie seems to be getting bogged down a little though, possibly too much script? The final swf size is only about 26k but everything is running with actionscript. Thanks for your help...I knew there had to be some snippet of code to help with frame rate issues.

                    That error message was showing up because i still had that dashed line in the code...duh!

                    The link again is www.dg8tal.com/portfolioidea.html

                    • 7. Re: Preserve frame rate when loading one swf into another
                      kglad Adobe Community Professional & MVP
                      that code is probably more complex than you need. it can be simplified if the framerate doesn't need to be too accurate.

                      the code above i made because i had to coordinate video framerate with an audio track for a movie trailer and the framerate had to be close to exact.

                      the code above has a self-correcting mechanism that keeps it on-track which adds one onEnterFrame handler to a normal setInterval() loop. that shouldn't really ad much over-head to your swf.

                      but if you want and you can accept a framerate that may be off by as much as one frame per second, i'll streamline the code so it omits that onEnterFrame handler and only loops fps times per second while the loop is active.
                      1 person found this helpful
                      • 8. Re: Preserve frame rate when loading one swf into another
                        kglad Adobe Community Professional & MVP
                        actually, after looking at that code more carefully it was deficient in a few ways that weren't factors for the project where i needed that code but may be factors when used by others.

                        i corrected the code in the edited message so it should be less likely to cause problems for others.
                        1 person found this helpful
                        • 9. Re: Preserve frame rate when loading one swf into another
                          kglad Adobe Community Professional & MVP
                          here's the streamlined code that's servicable when the framerate doesn't have to be precise: