Skip to main content
cinnamon_n
Participant
May 21, 2015
Answered

Close-Button inside swf File

  • May 21, 2015
  • 1 reply
  • 1026 views

Hello! I have been browsing the web to find an answer for quite a while now but can’t find a solution.

I am creating a banner with as3. It requires a close-button so that the user can click the button and close the ad.

It was very easy in as2 to do so. Could anybody help me out? I have created the button and tried different code snippets (event listener, fscommand("quit"), removing from the DOM). Thank you!

This topic has been closed for replies.
Correct answer kglad

that doesn't really remove anything.  there's still going to be white space occupied by the swf.

but, if that's acceptable you can do that with as3, too.  in your button listener function use:

MovieClip(root).parent.removeChild(root);

1 reply

kglad
Community Expert
Community Expert
May 21, 2015

if you're making an ad i'm not sure you'll be able to do what you want because you probably don't control the embedding html of the web page that's hosting your ad.

(and it wouldn't be any easier with as2.)

cinnamon_n
Participant
May 21, 2015

Hey kglad, thank you for your quick reply!

In my older version of flash I was able to use:


on(release){

_root.unloadMovie();

}

that worked just fine. Same banner specifications just older version of as. If I can’t find a solution I guess I have to reactivate my old laptop with my outdated flash version

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
May 21, 2015

that doesn't really remove anything.  there's still going to be white space occupied by the swf.

but, if that's acceptable you can do that with as3, too.  in your button listener function use:

MovieClip(root).parent.removeChild(root);