8 Replies Latest reply: Dec 28, 2012 10:12 AM by kglad RSS

    Major Problems!!! Memory issue?

    spindrift_loop Community Member

      So I am putting together a Flash cs5.5 website and currently I am sitting at over 300MB.  IT seems that as the project got larger the bugs increased ten fold.  Now I can't even publish it.  It starts to publish, gets 1/3 of the way then just stops.  It tells me it can't find eternal importers when trying to import new images or video to the project, or can't read files copy and pasted from Illustrator and so on...and so on...

       

      Is there anything I can do.  Im only at 260 frames but the resolution is 1000x1000.  I know some might suggest I lower all these things to avoid issues, but I want to know what I can do to complete it with these settings.  According to adobe memory shouldn't be an issue for quite a while.  I have 32gb ram and and pretty well equipped so I just don't see that there should be a problem on my end.  I am desperate for answers on this as I am working on a project for a client and would hate to see this fail.  I still need to import images and a host of other things and the project might get bigger down the road, and Thanks in advance.

        • 1. Re: Major Problems!!! Memory issue?
          kglad CommunityMVP

          your swf is 300mb?

           

          if so, you should be loading your bitmap and sound assets dynamically and not importing them into your fla.

          • 2. Re: Major Problems!!! Memory issue?
            spindrift_loop Community Member

            Just to clarify what my project is so maybe I can get clarification on whether loading images dynamically is really the best option, my client wanted a metal wheel with eight logos on it that rotates toward the user depending on which logo they are hovering over.  To do this I created a 3d animation using blender and exported the animation into a series of images which is what makes up each frame in my flash file.  Will the UI be able to import those images quick enough that as the video plays (8 frames for a single rotation animation) that it won't look choppy.  In other words does the UI loader load the images completely into the project before it begins, or does it try to do them one frame at a time as the frame is active?

            • 3. Re: Major Problems!!! Memory issue?
              kglad CommunityMVP

              anything you want displayed without pause would need to be preloaded.  ie, load it before it is needed.

               

              the time required to preload those images is not much different than the additional time needed to load your image containing swf vs the swf without those images.

              • 4. Re: Major Problems!!! Memory issue?
                spindrift_loop Community Member

                Alright thanks.  I have one more question.  I have been looking into dynamic image loading and am not finding much success in how this is done.  Would you be able to provide some sort of guidance in how to accomplish this?

                • 5. Re: Major Problems!!! Memory issue?
                  kglad CommunityMVP

                  if you have images logo1.png,logo2.png,...,logo100.png that you want to load:

                   

                  var tl:MovieClip=this;

                  var imageNum:int=1;

                  var imageTotal:int=100;

                  loadF();

                   

                  function loadF():void{

                  tl["loader_"+imageNum]=new Loader();

                  tl["loader_"+imageNum].contentLoaderInfo.addEventListener(Event.COMPLETE,loadcompleteF);

                  tl["loader_"+imageNum].load(new URLRequest("logo"+imageNum+".png"));

                  }

                   

                  function loadcompleteF(e:Event):void{

                  if(imageNum<imageTotal){

                  imageNum++;

                  loadF();

                  } else {

                  // loading of the images is complete.  you can now display any sequence without delays.  ie, start your app

                  startF();

                  }

                  }

                   

                  // if you wanted a function to display a sequence of your images (ie, an animation), you could use displayF by passing an array of the image numbers.

                  // for example, if you wanted to display images 1,2,3,4,5,6,7,8, you would use displayF([1,2,3,4,5,6,7,8]);.  if you wanted to display images 3,6,9,12,15,18,21,24, use displayF(3,6,9,12,15,18,21,24])

                   

                  function displayF(imageA:Array):void{

                  tl.imageA=imageA;

                  tl.currentIndex=0;

                  tl.addChild(tl["loader_"+imageA[0]]);

                  tl.addEventListener(Event.ENTER_FRAME,enterframeF);

                  }

                   

                  function enterframeF(e:Event):void{

                  tl.removeChild(tl["loader_"+tl.imageA[tl.currentIndex]]);

                  tl.currentIndex++;

                  if(tl.currentIndex<tl.imageA.length){

                  tl.addChild(tl["loader_"+tl.imageA[tl.currentIndex]]);

                  } else {

                  tl.removeEventListener(Event.ENTER_FRAME,enterframeF);

                  }

                  }

                  • 6. Re: Major Problems!!! Memory issue?
                    spindrift_loop Community Member

                    Thanks, your help was invaluable.

                    • 7. Re: Major Problems!!! Memory issue?
                      spindrift_loop Community Member

                      I guess I do have one more question.  Afte the images are loaded how do I assign them to specific frames, say I load the images then when they click a button it plays 8 framses and stops.  How do I assign those loaded pics to their proper frames along with their size and position in the frame?  I have almost no experience with Actionscript if you haven't guessed.  I've relied solely on snippets up to this point so Im getting aquainted with action script.

                      • 8. Re: Major Problems!!! Memory issue?
                        kglad CommunityMVP

                        you won't assign the images to frames.  you will display your animation using actionscript.

                         

                        displayF in message 5 shows you how to do that.  you only need to call displayF() and pass the sequence of images that you want to display.