5 Replies Latest reply on Aug 2, 2007 2:59 PM by brokedesigner

    how to control when a swf preloads (using flash 8 and as 2)

    brokedesigner
      I have a root swf that loads 4 other swfs into it, right now i have each swf loading one at a time however i want each swf to load immediately after the previous one is done whereas right now each swf only starts loading after the previous swf finishing playing.

      here's the main movie as im using right now


        • 1. Re: how to control when a swf preloads
          Level 7
          Which version of Flash, which version of Actionscript? Can you show the
          code that you're using now to load the clips?
          --
          Rob

          ___________
          Rob Dillon
          Adobe Community Expert
          http://www.ddg-designs.com
          412.243.9119
          • 3. Re: how to control when a swf preloads (using flash 8   and as 2)
            Level 7
            kflad knows his stuff :) One addendum I would make here:

            if ((bloaded == btotal) && (bloaded>0)) {

            On occassion, bloaded will be NaN and btotal will be NaN. No loaded, but
            technically the same, so your loop will end. The extra check ensures
            that the values are actual numbers.

            Also, I tend to set functions to undefined:

            framer.onEnterFrame=undefined;

            ...but that's just me.

            Patrick

            kglad wrote:
            > :
            >
            >
            >
            > stop();
            > btn1.enabled = false;
            > btn2.enabled = false;
            > btn3.enabled = false;
            > btn4.enabled = false;
            > holder1_mc._visible = false;
            > holder2_mc._visible = false;
            > holder3_mc._visible = false;
            > holder4_mc._visible = false;
            > swfs = ["slide1.swf", "slide2.swf", "slide3.swf", "slide4.swf"];
            > i = 0;
            > k = 1;
            > selected_mc._visible = false;
            > function loadslides() {
            > clearInterval(slideTimer);
            > my_btn = eval("btn"+k);
            > my_mc = eval("holder"+k+"_mc");
            > t_mc = eval("t"+k);
            > my_mc.loadMovie(swfs );v
            > loader_mc._x = t_mc._x;
            > loader_mc.gotoAndStop(1);
            > framer.onEnterFrame = function() {
            > bloaded = my_mc.getBytesLoaded();
            > btotal = my_mc.getBytesTotal();
            > per = Math.round((bloaded/btotal)*100);
            > loader_mc.gotoAndStop(per);
            > if (bloaded == btotal) {
            > selected_mc._x = t_mc._x;
            > selected_mc._visible = true;
            > loader_mc.gotoAndStop(1);
            > mc_quicktransition.gotoAndPlay(1);
            > mc_transition.gotoAndPlay(1);
            > my_btn.enabled = true;
            > i++;
            > if(i==swfs.length){
            > delete framer.onEnterFrame;
            > } else {
            > loadslides();
            > }
            > trace("ok");
            > }
            > };
            > }
            > function showcurrent() {
            > holder1_mc._visible = false;
            > holder2_mc._visible = false;
            > holder3_mc._visible = false;
            > holder4_mc._visible = false;
            > my_mc._visible = true;
            > my_mc.gotoAndStop(2);
            > }
            > loadslides();
            >

            --
            http://www.baynewmedia.com
            Faster, easier, better...ActionScript development taken to new heights.
            Download the BNMAPI today. You'll wonder how you ever did without it!
            Available for ActionScript 2.0/3.0.
            • 4. how to control when a swf preloads (using flash 8 and as 2)
              brokedesigner Level 1
              hmm... i tried that code it seems to be running the preloader for the first frame but the frame never loads and it keeps looping and i got no errors. is there something i need to add to the other swfs?
              I gotta say im a bit confused, i didn't write this code, i just need to get it to work for my boss.
              • 5. Re: how to control when a swf preloads (using flash 8 and as 2)
                brokedesigner Level 1
                anyone know what else i need add to this code? I've tried everything i can think of, i know it's probably really obvious but im not very experienced or good at AS.