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

unable to remove stage event listener from child swf

Explorer ,
Apr 12, 2012 Apr 12, 2012

Copy link to clipboard

Copied

Hi all I have made index swf which is loading other child swf's into index these swf's are images.swf, portfolio.swf, about.swf etc.., I have made 2 public function in each swf which is construct or diconstruct.

when i unload any swf then i play disconstruct public function of every child swf.. I stuck in when I remove stage event listener of every child swf then it shows error..

TypeError: Error #1009: Cannot access a property or method of a null object reference.

          at library_fla::MainTimeline/diconstruct()

here my diconstruct function of all child swf

function diconstruct(){

          pic.video.gotoAndStop(1)

          stage.removeEventListener(Event.RESIZE, sizeListener);

}

how i delete stage event listener of every child swf..???? I feel it is showing error because it is trying to remove event listener from index.swf

TOPICS
ActionScript

Views

907

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
Advocate ,
Apr 12, 2012 Apr 12, 2012

Copy link to clipboard

Copied

add trace statements to confirm which object is null.

also do you remove these swfs from the displaylist before you deconstruct them?

if so I think the stage property gets set to null (since they are not on the stage anymore)

and so stage.removeEventListener won't work

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
Explorer ,
Apr 12, 2012 Apr 12, 2012

Copy link to clipboard

Copied

ya i am running deconstruct function before remove those swf. when i trace stage in child swf's then it  showing null.

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
Advocate ,
Apr 12, 2012 Apr 12, 2012

Copy link to clipboard

Copied

LATEST

if it's stage that's null then the object can't be in the DisplayList

an alternative that by passes your problem but does not solve it

when adding your stage.removeEventListener(Event.RESIZE, sizeListener);

you could use

stage.removeEventListener(Event.RESIZE, sizeListener, false, 0, true);

this means the listener is eligible for garbage collection and you don't need to remove the listener

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