16 Replies Latest reply on May 24, 2010 11:27 PM by cyber0897

    .removeEventListener(Event.ENTER_FRAME  is not working please help


      hey guys... so i have a new problem... basically im trying to load a swf, and for this swf to load properly i need to pass it an id, and when the swf, after using the id gets all the necessary data, sets a variable called loadCompleted to true


      The problem is after my code encounters the loadComplete == true, it adds an image of that swf to my tileList, and it adds a million of these images, indicating that my event never got removed.... any ideas??


      i have the following code


      private function swfLoaded(event:Event):void{
           trace("-------------> in function swfloader");
           childSwf = new MovieClip();
           childSwf = event.target.content;
           childSwf.addEventListener(Event.ENTER_FRAME, compFrameEntered);
      private function compFrameEntered(event:Event):void{
           if(childSwf.currentFrame == childSwf.totalFrames){
                if(event.target.loadComplete == true){
                     trace("<<<<< load complete: " + event.target.loadComplete);
                     childSwf.removeEventListener(Event.ENTER_FRAME, compFrameEntered);
                     var myClip:MovieClip = event.target as MovieClip;
                     var imageBitmapData:BitmapData = ImageSnapshot.captureBitmapData(myClip);
                     var imgData:Bitmap = new Bitmap(imageBitmapData);
                     trace("load complete company ");



      it not only adds a million same images, but it also displays "load complete company" a million times....



      any ideas?? any help is greatly appretiated! ive been having this problem for a couple of days now