5 Replies Latest reply on Mar 11, 2010 2:24 PM by kglad

    HELP! actionscript on last frame of mc lost when placed in preloader

    monkycmonky2 Level 1

      Hi,

      I hope someone reading this can help me.

       

      My primary movie clip is 1200 frames long and on the last frame I have a small action: gotoAndPlay(190) so that it will loop back to that spot upon reaching the end, It works very nicely. UNTIL, that is, I place the primary movie in a frame within a preloader. When placed in the preloader, the primary clip doesn't loop back to frame 190 anymore; the actionscript is lost.

       

      I wanted a preloader so the area on the website dedicated to this flash file wouldn't appear blank as it loads.

       

      I found a tutorial online and followed it;

       

      I created a preloader mc with 5 layers:

       

      Actions               2 frames  2nd frame has the actionscript below in it

      Text                    2 frames 'loading...'

      Loader Outline     2 frames     .. the loading bar outline

      Loader Bar          2 frames      ..the actual bar

      Content               3 frames    3rd frame has my primary mc

       

      The script comes from www.webwasp.co.uk/tutorials/b05-preload/07.php I'd put the http but last time my post got deleted for something and I'm not sure if it was the link, cut and pasted code or a cut and pasted img.

       

      Anyway, the script in frame 2 of actions is:

       

      myLoaded = Math.round(getBytesLoaded());

      myTotal = Math.round(getBytesTotal());

      myPercent = myLoaded/myTotal;

      myBar._width = myPercent*150;

      myText = Math.round(myPercent*100)+"%";

      if (myLoaded == myTotal)

           {

           gotoAndStop(3);

           } else

           {

           gotoAndPlay(1);

           }

       

      Anyway, thank you very much for any insights you can offer!!!

        • 1. Re: HELP! actionscript on last frame of mc lost when placed in preloader
          kglad Adobe Community Professional & MVP

          recheck the last frame of your movieclip that's on the main timeline's frame 3.  ie, in the ide, go to frame 3, double click on the movieclip and copy and paste (here) the code in its last frame.

           

          also, make sure there's nothing that would cause your main timeline to move from its frame 3.

          • 2. Re: HELP! actionscript on last frame of mc lost when placed in preloader
            monkycmonky2 Level 1

            Thanks for your response.

             

            Forgive me, please, but what is ide?

             

            I guess I should retrace steps a bit.

            I created an fla of my primary clip. It's actually 1428 frames.

            The last frame has the action: gotoAndPlay("loop start"); (I forgot I'd changed the frame number to a label)

            Frame 290 on this fla timeline has the frame label: loop start

            It works as expected when exported as .swf.

             

            When I put the primary movie .swf inside of the preloader movie clip's .fla on the third frame of the content layer, and export that .fla as an .swf, that's when I notice the actionscript of the primary movie clip is gone.

             

            Am I right in believing you can nest .swfs and keep actions?

             

            Thank you again for your assistance.

            • 3. Re: HELP! actionscript on last frame of mc lost when placed in preloader
              kglad Adobe Community Professional & MVP

              that won't work.

               

              when you import a swf into the ide (integrated design environment, ie what you see when you open the flash program), all actionscript (not just goto) is lost.

               

              to remedy, create a movieclip of the original swf (eg, copy the main timeline to a new movieclip and paste the frames on the movieclip's timeline).  open two library panels and drag the movieclip of the original swf to your main library.  put that movieclip on your main movieclip's main timeline frame 3.

              • 4. Re: HELP! actionscript on last frame of mc lost when placed in preloader
                monkycmonky2 Level 1

                Thanks,

                Just copied the frames of my primary movie clip into a new flash document.(the one with the 1200+ frames and gotoAndPlay on last frame... Let's call it A)

                But I'm confused about which is which now.

                When you refer to the original swf you mean 'A' - the one with the 1200+ frames and the action script on the last frame and then

                'B' - the main movie clip is the loader into which I'm placing the primary into the 3rd frame of the contents layer?

                 

                How do you get two library windows open? Each time I try, my second attempt closes the first open library panel.

                 

                Forgive me please if I sound thick. I'm beginning to feel like I am, at least a little.

                • 5. Re: HELP! actionscript on last frame of mc lost when placed in preloader
                  kglad Adobe Community Professional & MVP

                  copy the frames and paste into a new moviecilp.  if that new movieclip is in B, you're done.  if that new movieclip is in A, you can open two panels by opening the first, click on its upper right on the icon (that has tooltip "new library panel').

                   

                  each library has a combobox so you can open the library of any swf currently open in your ide.  with the library from A and from B open you can drag and drop a movieclip from A to B.