- 浏览: 13634403 次
- 性别:
- 来自: 洛杉矶
文章分类
- 全部博客 (1994)
- Php / Pear / Mysql / Node.js (378)
- Javascript /Jquery / Bootstrap / Web (435)
- Phone / IOS / Objective-C / Swift (137)
- Ubuntu / Mac / Github / Aptana / Nginx / Shell / Linux (335)
- Perl / Koha / Ruby / Markdown (8)
- Java / Jsp (12)
- Python 2 / Wxpython (25)
- Codeigniter / CakePHP (32)
- Div / Css / XML / HTML5 (179)
- WP / Joomla! / Magento / Shopify / Drupal / Moodle / Zimbra (275)
- Apache / VPN / Software (31)
- AS3.0/2.0 / Flex / Flash (45)
- Smarty (6)
- SEO (24)
- Google / Facebook / Pinterest / SNS (80)
- Tools (22)
最新评论
-
1455975567:
xuezhongyu01 写道wocan23 写道我想问下那个 ...
Mysql: LBS实现查找附近的人 (两经纬度之间的距离) -
xuezhongyu01:
wocan23 写道我想问下那个111.1是怎么得来的我也看不 ...
Mysql: LBS实现查找附近的人 (两经纬度之间的距离) -
18335864773:
试试 pageoffice 在线打开 PDF 文件吧. pag ...
jquery在线预览PDF文件,打开PDF文件 -
青春依旧:
opacity: 0.5; 个人喜欢这种方式!关于其他css特 ...
css透明度的设置 (兼容所有浏览器) -
July01:
推荐用StratoIO打印控件,浏览器和系统的兼容性都很好,而 ...
搞定网页打印自动分页问题
Popup window ActionScript3 VS ActionScript2
- 博客分类:
- AS3.0/2.0 / Flex / Flash
A common feature that you can see on many Flash sites is the pop-up window. While this site features several tutorials on creating variations of the pop-up window, this one is a little bit different; it is centered. You click a button and the new window opens in the center of your screen regardless of your resolution.
Displaying a Centered Pop-Up Window:
-
Create a new movie by
going
to File | New. Set the width and height of your
movie to
anything you choose.
- 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.
[ select "Button" and press OK]
- 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:
on (release) { //customize the window that gets opened // 0 equals NO. // 1 equals YES. address = "http://www.kirupa.com/modular/pop-up.htm"; 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(address, target_winName, width, height, toolbar, location, directories, status, menubar, scrollbars, resizable); }
-
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:
_root.openWinCentre = function (url, winName, w, h, toolbar, location, directories, status, menubar, scrollbars, resizable) { getURL ("javascript:var myWin; if(!myWin || myWin.closed){myWin = 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 + "))+'" + "')}else{myWin.focus();};void(0);"); }
- 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.
Using Actionscript 2 all you need to use is this on your button….
on(release){ getURL (“javascript:popUp(‘http://www.cartoonsmart.com/fx_examples/the_gloom.html’)”); }
…..WITH the javascript below somewhere between your Head tags in the html thats embedding your swf….
<SCRIPT LANGUAGE=”JavaScript”> function popUp(theURL) { var top=open(theURL,”winname”,”width=600,height=500,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0″); top.focus(); } </SCRIPT>
Notice the function name popUp which appears in both sets of code. That should clue ya in as to how this works. And if you do want it to work, be sure you upload everything and test it live. Locally won’t do thing. You can see a working example here . Which is the same file included in the source files linked up below.
Now using Actionscript 3, here’s some less-than-perfect code for a movieclip with an instance name of your_button …
var js:URLRequest=new URLRequest(); js.url=”javascript:window.open(‘http://www.cartoonsmart.com’,'popUp’,'width=800,height=400′);newWindow.focus(); void(0);”; your_button.addEventListener(MouseEvent.CLICK,openPopUp); function openPopUp(evt:MouseEvent):void { navigateToURL(js,”_self” ); trace( “Warning! this might not work in browsers that are set to block pop up windows”); }
This example doesn’t need any javascript written in an html file.
Come to think of it, I probably could have found a similar method in AS2
that didn’t require adding code to your html, but whatever, it works.
You can see an example of the
AS3 Flash popup here
… But remember, it probably won’t work if your
browser prefs block popups.
- centerpopup_.rar (6.9 KB)
- 下载次数: 6
发表评论
-
iPhone、iPad 如何播放网页调用优酷视频?
2013-09-26 14:30 17680在线视频一般都是基 ... -
Scrolling Dynamically Loaded Text (as2)
2010-07-02 05:04 1923One quest ... -
flashAndPHP 简单交互
2010-06-17 01:53 1929第一章: flash,php 和 mysql ... -
交互动画按钮
2010-06-16 23:44 3669交互动画按钮 按钮元件是 Flash 的基本 ... -
引导路径动画 (2)
2010-06-16 23:41 17544.实例2——海底世界 ... -
引导路径动画 (1)
2010-06-16 23:31 3510引导路径动画(1) 在前面几节里,我们已经给大家介 ... -
动画基础
2010-06-16 23:22 1577动画的舞台结构及道具组合(1) 动画是一种动态 ... -
逐帧动画与夸张表情动画
2010-06-16 23:18 6437夸张表情动画的制作(1) (转之ET动画学堂) ... -
形状补间动画
2010-06-16 23:15 5433形状补间动画(1) ... -
逐帧动画与人运动动画制作
2010-06-16 23:11 4998人走路动画制作 ... -
动作补间动画
2010-06-16 23:07 4622动作补间动画(1) ... -
遮罩动画
2010-06-16 22:55 3539遮罩动画(1) ... -
加载loader (How to Load External Images in Actionscript 3.0)
2010-05-28 02:18 1809Using the flash.display.Lo ... -
元件变色 change movieclip's color
2010-05-28 01:34 1872// This line defines a varia ... -
Flash AS3获取PHP数据(ActionScript3 + php + email)送ActionScript2
2010-04-23 21:11 5787一,AS3部分[下载 ] package { ... -
flex与flash元件交互
2010-01-30 04:31 1889前一段时间发了flex与JavaScript的数据交互 ,现 ... -
FLEX里的CSS样式设置教材
2010-01-29 00:38 2352FLEX3中应用 CSS完全详解 ... -
flex 扇形菜单
2010-01-29 00:27 9181在继 auzn经典Flex教程–KingnareStyle ... -
flex 画线
2010-01-29 00:23 3495实例1: <?xml version=" ... -
Flex 中 12 个简单实用的小技巧
2010-01-26 06:32 16371. 复制内容到剪贴板 System.setCli ...
相关推荐
仿微信popup window,底部弹窗,有动画效果,可以直接移植到项目中去
非常简单的底部弹窗效果,一看就会,从屏幕下方滑进,点击外部滑出,还带一个点击关闭滑出
Change from child window to popup window (and back)(277KB)
一个采用C#+ASP.NET实现的Modal popup window图片模式窗体展示程序代码
一个基于ASP.NET实现的Masked Div Or Modal Popup Window程序源码例子。
web漂亮的弹出窗口,小巧精美,功能包括alert , prompt , confirm 和自定义对话框,带有遮罩层,支持ie6以上版本,FF等未经测试,欢迎大家使用。
Popup
NULL 博文链接:https://buptmax.iteye.com/blog/832138
Yc_ui_popup_window源码,是一个很不错的Android代码,有兴趣的伙伴们抽时间可以看一下把。
Creating Pop Up Window Using New Features in WebDynpro Java SAP NetWeaver
popup 弹出框popup 弹出框popup 弹出框popup 弹出框popup 弹出框popup 弹出框popup 弹出框popup 弹出框popup 弹出框popup 弹出框
弹出式视图IOS自定义Popup view,Popup Window============ 用法 //custom viewBBJShareAlertView * shareAlertView = [BBJShareAlertView initWithTitle:@"aa" andReferView:nil]; //Popup custom viewself....
Right click on link, click [Open this link in pop-up window] => po-pup link to standalone window.2. Right click on page, click [pop-up/merge current page] => move current page to standalone window.3....
popup.js popup.js 弹窗
popup.js下载
在Qt框架中,QComboBox是一个常用的下拉列表框控件,它允许...3、易于集成:由于这个资源是基于PySide2编写的,它可以轻松地集成到使用PySide2的Qt应用程序中。只需将你的自定义QComboBox子类替换原有的QComboBox即可。
Popup-Closer:关闭所有以WindowType'popup'打开的窗口
动态显示popup,定时关闭
【vue+leaflet+elementUI】vue项目中在Leaflet弹框Popup中使用elementui组件(三)cv可用 【vue+leaflet+elementUI】vue项目中在Leaflet弹框Popup中使用elementui组件(三)cv可用 【vue+leaflet+elementUI】vue项目中在...