Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > ActionScript Forums Group > ActionScript 1.0 (and below)

View Poll Results: how do u feel the turorial is?
Excellent 2 28.57%
good 2 28.57%
ok 3 42.86%
Voters: 7. You may not vote on this poll

Reply
 
Thread Tools Rating: Thread Rating: 3 votes, 5.00 average. Display Modes
Old 05-12-2004, 06:05 AM   #1
vazbo
Ax
 
vazbo's Avatar
 
Join Date: May 2004
Location: kuwait
Posts: 51
Send a message via MSN to vazbo Send a message via Yahoo to vazbo
Post Tutorial for Launching a Centered Pop-Up Window

Launching a Centered Pop-Up Window

Displaying a Centered Pop-Up Window:

1.Create a new movie by going to File | New. Set the width and height of your movie to anything you choose.

2.Draw a circle that will act as your button. Once you have drawn your circle, select it and press F8 (Insert | Convert to Symbol). The Convert to Symbol dialog box will appear. Select Button and press OK.

3.Now that the circle is a button, it is time to add some actions. Right click on the button and select Actions. The Actions dialog box will appear. Copy and paste the following code:



PHP Code:
on (release) {
    
//customize the window that gets opened
    // 0 equals NO.
    // 1 equals YES.
    
address "http://www.actionscript.org"
    
target_winName "kirupa";
    
width 400;
    
height 300;
    
toolbar 0;
    
location 0;
    
directories 0;
    
status 0;
    
menubar 0;
    
scrollbars 1;
    
resizable 0;
    
//sends data back to the function
    
openWinCentre(addresstarget_winNamewidthheighttoolbarlocationdirectoriesstatusmenubarscrollbarsresizable);

5.The last step involves adding some more actions. Insert another layer on your timeline and name it "actions". Right click on the keyframe on the "actions" layer and select Actions. Copy and paste the following code into the Actions dialog box that appears:



PHP Code:
_global.openWinCentre = function(urlwinNamewhtoolbarlocationdirectoriesstatusmenubarscrollbarsresizable) {
        
getURL("javascript:window.open('"+url+"','"+winName+"','"+"width="+w+",height="+h+",toolbar="+toolbar+",location="+location+",directories="+directories+",status="+status+",menubar="+menubar+",scrollbars="+scrollbars+",resizable="+resizable+",top='+((screen.height/2)-("+h/2+"))+',left='+((screen.width/2)-("+w/2+"))+'"+"');void(0);");
}; 
6.Save the animation and preview it in your browser. You will notice that the window appears perfectly centered.



Customizing the Window
Unless you want your pop-up window to display updates from the kirupa.com site, you probably want to modify the window size, content it loads, and the window's attributes such as toolbars, etc. The following information should help you to customize the window.

Right click on your button and select Actions. You will see in the first few lines, that I mentioned the property and its value. To change the URL of the page that gets opened, simply change the text in quotation marks after the word "address". To enable a property that is disabled like displaying the status bar, find the line that says "status =" and change the 0 to a 1. Simple as that. I will explain what each variable stands for in the real world:

address
The address is the path to the page you want to have opened in the pop-up window.


target_winName
This is the name of the window that will be opened. If you are familiar with frames, you will know that each frame-page has a name attached to it. When you link, you specify the name of that frame to load a page into.

This tag works very similar for the pop-up window. If you want anything to be loaded into the window, you would target the window name you specify. You don't have to worry about this tag unless you are familiar with HTML. Just enter a word and move on!


width
Here is where you would specify the width of the window that appears.


height
Here is where you would specify the height of the window that appears.


toolbar
Specifies whether you want the pop-up window to display the browser's toolbar with the back/forward buttons.


location
Specifies whether you want the address bar to be displayed in your browser.


directories
Specifies whether you want other toolbars installed by the user in their browser such as a Google toolbar or a Links toolbar to displayed when a page is opened.


status
Specifies whether you want the status bar toward the bottom of the window to be displayed.


menubar
Specifies whether you want the menu bar with the File, Edit, View Tools, etc. commands to be visible near the top of the browser.


scrollbars
Specifies whether you want the scrollbars to be displayed in the window. If the content exceeds the size of the window, I highly recommend you enable the use of scrollbars. If the content snugly fits within the window, you may disable the scrollbars feature if you would like!


resizable
Specifies whether the use will be able to resize the window by dragging the edges of the window.




As always, I have provided the source code for you to compare your version with that of mine. Make sure you have WinZip installed on your computer.
Attached Files
File Type: zip centerpopup.zip (7.4 KB, 1560 views)

Last edited by vazbo; 05-12-2004 at 07:30 AM.
vazbo is offline   Reply With Quote
Old 05-12-2004, 06:49 AM   #2
farafiro
Addicted To FLASH
 
farafiro's Avatar
 
Join Date: Dec 2001
Location: Egyptian in UAE
Posts: 12,436
Send a message via MSN to farafiro Send a message via Yahoo to farafiro
Default

what about this:

http://www.actionscript.org/tutorial...en/index.shtml

__________________
‚€* GOD Is Near ‚€*
Questions Don't PM for Questions . Thanks
An eye for an eye, make the whole world blind
_____________________________________________GHANDI
farafiro is offline   Reply With Quote
Old 05-12-2004, 07:26 AM   #3
vazbo
Ax
 
vazbo's Avatar
 
Join Date: May 2004
Location: kuwait
Posts: 51
Send a message via MSN to vazbo Send a message via Yahoo to vazbo
Default

actually i didnt wanted touch my html file
vazbo is offline   Reply With Quote
Old 05-12-2004, 07:41 AM   #4
farafiro
Addicted To FLASH
 
farafiro's Avatar
 
Join Date: Dec 2001
Location: Egyptian in UAE
Posts: 12,436
Send a message via MSN to farafiro Send a message via Yahoo to farafiro
Default

ahuh
okey
__________________
‚€* GOD Is Near ‚€*
Questions Don't PM for Questions . Thanks
An eye for an eye, make the whole world blind
_____________________________________________GHANDI
farafiro is offline   Reply With Quote
Old 05-12-2004, 08:52 AM   #5
oldnewbie
Banned by AS.org Staff
 
Join Date: Mar 2002
Posts: 10,533
Default

Ummmmmmmmmmmh!

http://www.flash-db.com/PopUp/
oldnewbie is offline   Reply With Quote
Old 04-19-2008, 09:43 AM   #6
hanbok
Registered User
 
Join Date: Nov 2005
Location: UK
Posts: 20
Default

and how we add text in that popup window please with actionscript
hanbok is offline   Reply With Quote
Old 09-11-2009, 10:19 PM   #7
amorini
Registered User
 
Join Date: Sep 2009
Posts: 2
Default

This is great! Thanks!

Is there a way to have different content loading in the same popup window rather then opening a new popup window?

I have 10 buttons that load 10 different swf in a popup window, and I would like to not have 10 popups but just 1 that loads different content when a different button is clicked. possible?

thanks!

andre
amorini is offline   Reply With Quote
Old 12-26-2009, 01:25 PM   #8
dimk1
Registered User
 
Join Date: Dec 2007
Posts: 2
Default

It doesn't work in IE 8. I get an error like invalid argument. any idea?
dimk1 is offline   Reply With Quote
Old 12-26-2009, 05:22 PM   #9
loadlearn
Banned by AS.org Staff
 
Join Date: Apr 2009
Posts: 1,550
Default

This script works fine with IE8: http://www.kirupa.com/developer/mx/centered_popup.htm
loadlearn is offline   Reply With Quote
Old 01-01-2010, 11:01 PM   #10
flash_newbee
Registered User
 
Join Date: Dec 2009
Posts: 7
Default

to amorini/andre
you can just make the target of the link be "_parent"

PHP Code:
target_winName "_parent" 
flash_newbee is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:22 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.