Learn Flash: Pop Ups

HomeTutorialsForumWebwasp MembersTemplatesMatesFoodContact

 


Flash Tutorials

   

Flash - Pop Up Windows

 

Free Flash Pop Up Tutorial


Step 1    <<   Previous      Intro   1   2   3   4     Next   >>       >>   Webwasp Mates

 

Step One: Left Button Script

 

Example: Download the Flash file Int 112a

 

Click the buttons to see the Pop Ups.

The following script is attached to the button on the left:

on (release) {
    MovieClip.prototype.openWin1 = function(url, winName, w, h, toolbar, location, directories, status, menubar, scrollbars, resizable){     
    getURL("javascript:var myWin1;if (!myWin1 || myWin1.closed){myWin1=window.open('"+url+"', '"+winName+"', '"+"width="+w+", height="+h+", toolbar="+toolbar+", location="+location+", directories="+directories+", status="+status+", menubar="+menubar+", scrollbars="+scrollbars+", resizable="+resizable+", top='+0+', left='+150+'"+"')} else{myWin1.focus();};void(0);"); };

    address = "pop1.htm";
    winName = "window1";
    width = 400;
    height = 300;
    toolbar = 0;
    location = 0;
    directories = 0;
    status = 0;
    menubar = 0;
    scrollbars = 0;
    resizable = 0;
    openWin1(address,winName,width,height,toolbar,location,directories,status,menubar,scrollbars,resizable); }


Note:
In the ActionScript above to type the line: | use: Shift + Back Slash \

Line by Line:

on (release) {
When the mouse clicks the button do the following...

    Movieclip.prototype.openWin1 = function(url, winName, w, h, toolbar, location, directories, status, menubar, scrollbars, resizable) {
    This must be one line in the Action panel.
    The line declares a function that has various parameters (URL, Window Name etc.) This line does not do anything until the function is declared further down in the script.

    getURL("javascript:var myWin1; if(!myWin1 || myWin1.closed){myWin1 = window.open('"+url+"', '"+winName+"', '"+"width="+w+", height="+h+", toolbar="+toolbar+", location="+location+", directories="+directories+", status="+status+", menubar="+menubar+", scrollbars="+scrollbars+", resizable="+resizable+", top='+0+', left='+150+'"+"')} else{myWin1.focus();};void(0);");
    This must be one line in the Action panel.
    When the function is called, this line does the actual work. It sends all the info to the Browser to open a new Window. It tells the browser what size, position and various other specifications (which I will come back to). You will notice that this is not ActionScript but JavaScript (getURL("javascript:). This is because the Browser cannot understand ActionScript.

    };
    This closes the function.

    Important Note: Because the function above sends info to the Browser (to open a new Window) the code will not work in Flash test mode. To test your work you must first Publish the Flash movie and test it in a Browser.

    address = "pop1.htm";
    The name of the file you wish to Pop up.
    Normally Pop Ups are web pages but I guess it could be a Jpeg, Gif, Flash movie (swf's) or any other file that a browser can open, although I have not tried this.

    winName = "window1";
    The name of the window. This is similar to target frames in HTML. Each Pop Up Window needs to have a unique name like: "window1" "window2" "window3" etc.

    width = 400;
    The width of the Pop Up Window in pixels.

    height = 300;
    The height of the Pop Up Window in pixels

    toolbar = 0;
    If you want the toolbar buttons to be visible type 1, or type 0 if they are to be switched off.

    location = 0;
    If you want the (URL) Address bar to be visible type 1, or type 0 if it is to be switched off.

    directories = 0;
    If you want the toolbars like Links or Google etc. to be visible type 1, or type 0 if they are to be switched off.

    status = 0;
    If you want the Status bar at the bottom of the Window to be visible type 1, or type 0 if it is to switched off.

    menubar = 0;
    If you want the Menu buttons to be visible type 1, or type 0 if they are to be switched off.

    scrollbars = 0;
    If you want the Scroll bars to be visible type 1, or type 0 if they are to be switched off.

    resizable = 0;
    If you want the Window to be resizable type 1, or type 0 if it is fixed size.

    openWin1(address,winName,width,height,toolbar,location,directories,status,menubar,scrollbars,resizable); Sends all the above info to the function on line 2 called: openWin1

}
Closes the handler: on (release)

         

Step 1    <<   Previous      Intro   1   2   3   4     Next   >>       >>   Webwasp Mates


Webwasp Community: Webwasp Mates & Dates

Why not try out webwasp's new community. Meet new people, find friends in your area: Webwasp Mates & Dates

Phil Schulz's Facebook profile
Webwasp is Phil Schulz's baby. You are welcome to contact me or become my Facebook friend: Click here

 Top of Page Home Food Mates Members Tutorials Forum Buy Templates Contact Us 
 All material on this site is protected under international copyright © law. DO NOT reproduce any material from this site without written permission. Please ask as permission is often granted.