手机
当前位置:查字典教程网 >网页设计 >Flash教程 >Flash Actionscript常用的几段代码
Flash Actionscript常用的几段代码
摘要:FlashActionscript常用的几个代码,可以直接操作打印机、调用Outlook、调用JS代码、设置网页为首页等。1、flash调用...

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:tslxg@hotmail.com");

//调用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('http://www.jb51.net/flash/index.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.jb51.net/')", "_self", "OST");

}

注意要将网页中的flash的ID号命名为"links"

加入收藏夹:

on (release) {

getURL(" window.external.AddFavorite(http://www.jb51.net,'网页');", "_self", "OST");

}

【Flash Actionscript常用的几段代码】相关文章:

Flash贪吃蛇游戏AS代码翻译

flash as3实现打字小游戏代码

flash as3 打气球小游戏代码

Flash制作跳动的火苗动画效果

Flash as3:绝对坐标与相对坐标

Flash制作一幅诗意的水墨卷轴展开的动画

Flash 行走动画的几种实现方式

Flash中逼真的瀑布特效动画源码

Flash AS3制作数字落下的动画特效

ActionScript3教程:语句实例

精品推荐
分类导航