当前位置: 首页 > 图文教程 > Flash动画 > ActionScript > Flash Actionscript常用的几段代码

ActionScript
ActionScript3教程:语句实例
ActionScipt技巧和开发中会遇到的问题
Flash as3.0教程:弹性小球
flash as简单制作飘雪动画
Flash AS 教程:交互动画
Flash ActionScript 3.0教程:学习Dot类
Flash AS 教程:子类化显示对象
Flash AS 教程:动画事件
Flash AS 教程:创建文档类(Document class)
Flash AS 教程:帧循环
Flash AS 教程:类和面向对象编程
Flash AS 教程:构造函数(Constructor)
Flex程序开发心得小结
Flash游戏开发教程:第一节
FLASH中的元件能在Flex中完美使用
关于XML在FLASH中的应用
Flash AS教程:decorator Pattern
Flash AS实例教程:简单的loading
Flash教程:彻底学习RadioButton组件
Flash AS教程:复制粘贴类

ActionScript 中的 Flash Actionscript常用的几段代码


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-16   浏览: 50 ::
收藏到网摘: n/a

Flash Actionscript常用的几个代码,可以直接操作打印机、调用Outlook、调用JS代码、设置网页为首页等。
1、flash调用打印机 //库里一个mc,连接符为aa,舞台上一个按钮,名字为print_btn
this.createEmptyMovieClip("creat_mc", 999);
creat_mc.attachMovie("aa", "aa_mc", 1000, {_x:200, _y:200});
print_btn.onPress = function()
{
var printJobrintJob = new PrintJob();
var isStartPrint:Boolean = printJob.start();
if (isStartPrint)
{
printJob.addPage(_root, {printAsBitmap:true});
printJob.send();
}
delete printJob;
};
//提示,打印那桢停哪桢,PrintJob类其他方法就不写了,按f1自己看吧。
////////////////////////////////////////////
2、调用outlook,我的电脑,回收站等 //先在舞台上建个叫aa_btn的按钮
_root.aa_btn.onPress = function()
{
getURL("mailto:[email protected]");
//调用outlook必须放到服务器上使用,本地无效
//链接[我的电脑].swf放桌面上有效,以下一样
getURL("file:///::{20D04FE0-3AEA-1069-A2D8-08002B30309D}");
//链接[我的文档]
//getURL("file:///::{450D8FBA-AD25-11D0-98A8-0800361B1103}");
//链接[网上邻居]
//getURL("file:///::{208D2C60-3AEA-1069-A2D7-08002B30309D}")
//链接[控制面版]
//getURL("file:///::{20D04FE0-3AEA-1069-A2D8-08002B30309D}/::{21EC2020-3AEA-1069-A2DD-08002B30309D}");
//链接[回收站]
//getURL("file:///::{645FF040-5081-101B-9F08-00AA002F954E}");
};

/////////////////////////////////////////
3、flash调用js函数 //就举个例子,其他的自己试吧,大括号内写成一行,放网页上,本地无效,网页中的高,宽要全改为100%
aa_btn.onPress = function()
{
getURL("javascript:NewWindow=window.open('/upload/tech/20090916/20090916063010_185e65bc40581880c4f2c82958de8cfe.html','newWin','width=660,height=480,left=0,top=0,toolbar=No,
location=No,scrollbars=No,status=No,resizable=No,fullscreen=No'); NewWindow.focus(); void(0);");
};
////////////////////////////////////////////
4、设为首页: on (release) {
getURL(";void document.links.setHomePage('http://www.ruanchen.com/'网页');", "_self", "OST");
}