• Pin It

Tips & Tricks 7: Create Popup Windows in Flash – ActionScript 3.0

A couple of days ago a fellow asked me how can he makes a popup window in Flash for his website. I showed him how and I was thinking why not to share with you also. It’s an easy and very powerfull trick.

Here we go (this example is for Actionscript 3.0):

1. Create a MovieClip and give an instance name (e.g: myMovie)

2. Add an event listener to the movie you created:

3. Create the mousePress function like so:
function mousePress(e:MouseEvent){

var url ="javascript:window.open(‘http://www.yoursite.com’,’title’,

var request1:URLRequest = new URLRequest(url);

try {
catch (e:Error) {
trace("Error occurred!");

4. Publish the movie and preview it in your browser.

Author: Alin

Passionate about web and graphic design, photography and climbing. Follow me at Twitter , Facebook and Google+

  • good stuff! thanks for the tip

  • quick question: stated playing around with this, kicks out

    “1095: Syntax error: A string literal must be terminated before the line break.” regarding the var url string.

    also never seen “mousedown” as the event type. I’m used to addEventListener(MouseEvent.MOUSE_DOWN, mousePress)…. is that a different way to event type a listener?

  • The error appears because I put two Enter keys in the attached string for “url” variable so all the example code to be displayed. When you test it in Flash write it in a single line. Also a “}” is missing for the function to be ended.

    For the MouseEvent you can use both the string like I do or the longer version, i’m used with the first one:)

  • I added the missing bracket to the example code.

  • cool, you learn something everyday: I never knew you could put a string as the Event type. Thanks.

  • Pingback: Daily Trick 7: Create Popup Windows in ActionScript 3.0 | Flash User | Adobe Tutorials()