• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

.removeEventListener(Event.ENTER_FRAME is not working please help

New Here ,
May 24, 2010 May 24, 2010

Copy link to clipboard

Copied

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

Views

1.5K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 06, 2010 Jun 06, 2010

Copy link to clipboard

Copied

Hi,

I tried your example without the Imagesnapshot. For that case, it seemed to be working fine. I suspect something is amiss in the swf code.

Did u have to make any modifications in your flash code for making this line work

ImageSnapshot.captureBitmapData(myClip);

Because it flagged a runtime argument error for me.

Nishad

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 07, 2010 Jun 07, 2010

Copy link to clipboard

Copied

LATEST

hey nishad... thanks for replying.. the problem i was running into was that i accidently was instantiating the enterframe a few too many times... i had to change the structure of my code to get it working.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines