- 浏览: 13730714 次
- 性别:
- 来自: 洛杉矶
文章分类
- 全部博客 (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 17736在线视频一般都是基 ... -
Scrolling Dynamically Loaded Text (as2)
2010-07-02 05:04 1961One quest ... -
flashAndPHP 简单交互
2010-06-17 01:53 1961第一章: flash,php 和 mysql ... -
交互动画按钮
2010-06-16 23:44 3724交互动画按钮 按钮元件是 Flash 的基本 ... -
引导路径动画 (2)
2010-06-16 23:41 18004.实例2——海底世界 ... -
引导路径动画 (1)
2010-06-16 23:31 3560引导路径动画(1) 在前面几节里,我们已经给大家介 ... -
动画基础
2010-06-16 23:22 1630动画的舞台结构及道具组合(1) 动画是一种动态 ... -
逐帧动画与夸张表情动画
2010-06-16 23:18 6478夸张表情动画的制作(1) (转之ET动画学堂) ... -
形状补间动画
2010-06-16 23:15 5480形状补间动画(1) ... -
逐帧动画与人运动动画制作
2010-06-16 23:11 5040人走路动画制作 ... -
动作补间动画
2010-06-16 23:07 4666动作补间动画(1) ... -
遮罩动画
2010-06-16 22:55 3575遮罩动画(1) ... -
加载loader (How to Load External Images in Actionscript 3.0)
2010-05-28 02:18 1849Using the flash.display.Lo ... -
元件变色 change movieclip's color
2010-05-28 01:34 1905// This line defines a varia ... -
Flash AS3获取PHP数据(ActionScript3 + php + email)送ActionScript2
2010-04-23 21:11 5834一,AS3部分[下载 ] package { ... -
flex与flash元件交互
2010-01-30 04:31 1923前一段时间发了flex与JavaScript的数据交互 ,现 ... -
FLEX里的CSS样式设置教材
2010-01-29 00:38 2402FLEX3中应用 CSS完全详解 ... -
flex 扇形菜单
2010-01-29 00:27 9224在继 auzn经典Flex教程–KingnareStyle ... -
flex 画线
2010-01-29 00:23 3538实例1: <?xml version=" ... -
Flex 中 12 个简单实用的小技巧
2010-01-26 06:32 16741. 复制内容到剪贴板 System.setCli ...
相关推荐
3. **初始化popup window**:创建PopupWindow实例,传入加载好的View,设置其宽度、高度、是否可触摸等属性。 4. **设置动画**:为了达到微信那样的动画效果,需要自定义动画资源文件,例如渐显渐隐、滑动进出等。...
Popup Window在IT行业中是一个常见的术语,它主要指的是在用户界面中弹出的一个小型窗口,用于显示额外的信息或者进行特定操作。这种技术广泛应用于各种软件、网站和移动应用中,为用户提供交互式的体验。本篇文章将...
在Android应用开发中,"bottom_popup_window"是一个常见的设计元素,用于展示临时的通知或功能选项。这个标题描述了一个简单易用的底部弹窗效果,它从屏幕底部滑入,用户可以通过点击外部区域轻松滑出,同时也支持...
【C#+ASP.NET Modal popup window 图片模式窗体展示程序详解】 在Web开发中,Modal Popup Window(模态弹出窗口)是一种常见的交互设计模式,它用于在用户操作当前页面时显示临时信息或进行交互。在ASP.NET环境中,...
标题为“Change from child window to popup window (and back)”的主题涉及到Windows API中的两种主要窗口类型:子窗口(Child Window)和弹出窗口(Popup Window)。理解这两种窗口类型及其转换方法对于Windows...
3. 遵守浏览器规范:确保Popup Window的实现符合W3C标准和浏览器的推荐做法,避免被浏览器视为恶意行为。 4. 测试与兼容性:在多种浏览器和设备上测试Popup Window的显示效果和功能,确保其在各种环境下都能正常...
在本源码例子中,“基于ASP.NET实现的Masked Div Or Modal Popup Window”是一个功能,它允许在网页上创建遮罩层弹出窗口,通常用于显示警告、确认对话框或者加载内容时提供一种半透明的覆盖层,以防止用户在处理...
在网页设计中,"dialog popup window"是一种常见的交互元素,用于向用户展示信息或获取用户的输入。这个压缩包提供了一套完整的解决方案,用于创建美观且功能丰富的弹出对话框。以下是对这些文件及其关联知识点的...
在Android开发中,`Yc_ui_popup_window`是一个常见的自定义弹窗库,它提供了丰富的弹窗样式和功能,使得开发者能够更加灵活地定制属于自己的弹窗组件。这个开源项目通常包含一系列源码文件,例如布局文件、Java或...
2. `window.confirm()`: 显示一个带有“确定”和“取消”两个按钮的确认对话框。用户的选择会返回一个布尔值,`true`表示“确定”,`false`表示“取消”,根据返回值可以执行不同的操作。 3. `window.prompt()`: ...
2. **添加Popup内容**:在Popup的内部,可以添加任何你想要展示的UI元素,如TextBlock、Button、Image等。 3. **响应事件**:为了实现点击弹出窗口外部关闭Popup的功能,我们需要监听窗口的触摸事件。在后台代码中...
例如,使用`window.open()`函数可以创建一个新的浏览器窗口,或者通过CSS定位一个隐藏的元素使其可见来模拟弹出效果。 在应用程序开发中,Popup通常是对话框的形式,如消息框、选项框或输入框。这些组件通常由编程...
在JavaScript中,最简单的popup实现是使用`window.open()`函数创建新窗口。这个函数接受一个URL和一个窗口名称作为参数,可以用来打开一个新的浏览器窗口或标签页。例如: ```javascript var popup = window.open('...
3. **resize**:可能是指在JavaScript中调整弹出窗口的大小,可以通过`window.resizeTo()`或`window.innerWidth/innerHeight`属性来实现。 4. **browser**:指的是这个项目适用于多种浏览器环境,确保在不同的浏览器...
- popup.css 可能涉及弹出窗口或提示框的样式,比如代码示例或帮助信息的显示。 - content-ie6.css 专门针对Internet Explorer 6浏览器的兼容性问题,保证在较旧的浏览器上也能正常显示。 综上所述,ActionScript ...
3. **CSS样式控制**:为了改变弹出框的外观,`popup.js`可能会操作CSS属性,比如改变元素的可见性(`display`)、位置、大小等。这可以通过`element.style`对象来实现。 4. **弹出框的显示与隐藏**:`popup.js`中会...
3. **遍历窗口对象**:Popup-Closer可能遍历`window.opener`、`window.parent`和`window.frames`属性,查找并关闭所有`WindowType`为'popup'的子窗口。 4. **窗口操作**:JavaScript提供了诸如`window.close`的方法...
var popup = window.open(url, name, features); }); ``` 在上面的代码中,我们创建了一个名为`popupWindow`的新窗口,设置了它的大小、位置和其他特性。`popup`变量现在引用了新打开的窗口,你可以通过它与窗口...
在Windows Presentation Foundation (WPF) 中,`Popup`...通过打开`WpfApp3.sln`,我们可以查看并学习这个例子的具体实现方式,包括如何使用`Popup`来封装数据筛选框。如果遇到问题,可以联系博主以获取支持和帮助。