Skip to main content
Participating Frequently
February 15, 2015
Question

I need an AS2 button that closes out a pop-up window...

  • February 15, 2015
  • 1 reply
  • 1164 views

So, I’ve constructed a portfolio site with ActionScript 2.0, but I would like the pop-up window that displays the portfolio image to have its own ‘X’ button that closes the swf movie from the browser.  I’m assuming that the code begins something like this:

on(release){

//actionscript 2.0 code that closes the browser window.

}

Any suggestions on how this will work across platforms and browsers?

Best,

R.

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
February 17, 2015

how do you create the popup?  ie, show the code used.

Tic_TocAuthor
Participating Frequently
February 19, 2015

Hi kglad,

My main flash as2 file has a stage size of 1200 width x720 height.  I’ve looked online through various methods on creating pop-up browsers that will display a portfolio image when a button on the main.swf is clicked.  Having no luck in finding what I needed (most tutorials just give getURL examples where the image is displayed in a separate tab), it finally dawned on me to create an overlaying movie, of the same size as the document size, on the top layer of the primary flash stage.  Setting the movie symbol as ‘invisible’ keeps the movie symbol inactive and invisible until called by an action.  The button on the main.swf that calls the movie has the following as2 script attached to it:

on(release){

               loadMovie("images/aauComp.swf", _root.movie2);

}

However, the aauComp.swf file is where the exit button is located.  I need to implement an on(release){} method onto the exit button in aauComp.swf  that will close the movie out in the main.swf file.  Here’s the double wammy, though: the exit button on the called movie file, aauComp.swf, does not recognize any gotoAndStop(); or on(release){} functions relating to itself when it is loaded. For instance, since I could not find any functions that would close the movie out and return me to the main.swf interface, I wrote the following command on the ‘exit’ button in aauComp.swf:

on(release){

               _root.gotoAndStop("blank_frame");

}

Where “blank_frame” is within a scene of aauComp.swf that is completely empty – which should, in theory, allow for interaction with the main.swf below the loaded movie since there is nothing on that layer of the loaded aauComp.swf movie.  Make sense?  The ‘exit’ button works fine when aauComp.swf is tested and published by itself, but when it is called into the main.swf with the loadMovie(); function, the 'exit' button will not work and, so, it will not forward to the “blank_frame”.

Any suggestions?  Let me know if you need anything clarified.

Thanks.

kglad
Community Expert
Community Expert
February 19, 2015

if you use loadMovie() to create your 'popup', use unloadMovie() to remove the loaded swf or swap depths (if needed) of _root.movie2 and use removeMovieClip().

if you use a goto to create your 'popup', use another goto to make it appear as if it's removed.