5 Replies Latest reply on Jun 3, 2009 6:34 PM by Flex harUI

    Pushing Loader.content into DisplayObject Freezes Animation

    damonfarr Level 1

      I am working on a slideshow app which involves a bunch of images with mask effects cycling one after the other. I created a buffer to preload images in the background while the animation plays. I am using Tweener for all my tweens, and this has nothing to do with garbage collection or declaring vars inside function scope. The problem is the following lines of code in my complete handler of the flash.display.Loader class cause the animation to freese for a split second:

       

      _preloadingSlide.source = _preLoader.content;
      _preloadingSlide.loading = false;
      _preloadingSlide.loaded = true;

       

      _preloadingSlide is an insctance of a custom class that extends Sprite. The source attribute is a setter/getter whos code is as follows:

       

      public function set source( value:DisplayObject ):void{
                  _source = value; //_source is of type DisplayObject
                  if( _source!= null ){
                      addChild( _source );
                  }
              }

       

      I have isolated the error to these lines of code. When I halt execution while buffering and wait until all images are loaded there is no issue. Whenever these line execute it freezes the animation for a half second or so. I thought maybe it had to do with the internal copying the bytearray that FLASH is doing. Anyone have any ideas?