Quantcast
Channel: Adobe Community : Popular Discussions - Using Flash Builder
Viewing all articles
Browse latest Browse all 70427

.removeEventListener(Event.ENTER_FRAME is not working please help

$
0
0

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.init(name[1]);
     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);
               slideImages.addItem(imgData);
              
               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


Viewing all articles
Browse latest Browse all 70427

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>