1. 在帧1上书写一些actions。这些actions的目的是为了限定MC的大小。这样我们的MC就不会因为使用者的人为自主放大缩小而改变了大小,以免造成不必要的紊乱。
还可以写代码:10,如果屏蔽鼠标右键?FS命令都是什么意思?
fscommand ("fullscreen", "true/false");(全屏设置,TRUE开,FALSE关)
fscommand ("showmenu", "true/false");(右键菜单设置,TRUE显示,FALSE不显示)
fscommand ("allowscale", "true/false");(缩放设置,TRUE自由缩放,FALSE调整画面不影响影片本身的尺寸)
fscommand ("trapallkeys", "true/false");(快捷键设置,TRUE快捷键开,FALSE快捷键关)
fscommand ("exec");(EXE程序调用)
fscommand ("quit");(退出关闭窗口)
//如果你不想看到
Flash的About和设置菜单
//把下面的代码放到第一帧就行了:
_root.createTextField("danger", 999, 0, 0, Stage.width, Stage.height);
//好了,现在换了一个新菜单.
//注:这个适合用在没有交互的
动画上,如果你需要使用按钮就去掉.
关闭
on(release){
getURL("javascript:self.close();")
}
最小化
on (release) {getURL("JavaScript:window.blur()");}
2.
stop();//停止
oldtime=getTimer();//得到当前时间
waittime=10;//要等待的时间
function go(){
//trace("id1="+id1);
//trace(Math.floor(getTimer()/1000));
if(Math.floor((getTimer()-oldtime)/1000)>10){
play();
clearInterval(id1);
//trace("id1="+id1);
}
}
id1=setInterval(go,500);//每0.5秒测一次
stop();
// 停止
oldtime = getTimer();
// 得到当前时间
waittime = 3;
// 要等待的时间
setInterval(go, 500);
// 每0.5秒测一次
function go() {
if (Math.floor((getTimer()-oldtime)/1000) == waittime) {
play();
}
}
第九帧
stop();
this.onEnterFrame = function() {
prevFrame();
};
mouseevent是鼠标事件,包括有:
press: 鼠标指针在按钮上并单击
release: 鼠标指针在按钮上被释放
releaseoutside: 鼠标指针在按钮外被释放
rollover: 鼠标指针移进按钮区域内
rollout: 鼠标指针移出按钮区域内
dragover: 鼠标指针在按钮上被按下,移出按钮再移回
keypress: 鼠标指针在按钮上,然后鼠标按下,再移出按钮区域
on (release) {
count = 1;
while (count<20) {
_root.box.duplicateMovieClip("boxx"+count, count);
_root["boxx"+count]._x = random(550);
_root["boxx"+count]._y = random(150);
_root["boxx"+count]._xscale = random(150);
_root["boxx"+count]._yscale = random(150);
_root["boxx"+count]._alpha = random(100);
count += 1;
}
}
用MC代替按钮:
mc.onRollOver = function() {
y = 1;
};
mc.onRollOut = function() {
y = 0;
};
mc.onEnterFrame = function() {
if(y==1) {
mc.nextFrame();
}else {
mc.prevFrame();
}
};
1,先在flash的按钮上添加代码:
首页:
on (release) {
fscommand("setHomePage", "http://www.flash8.net";);
}
收藏夹:
on (release) {
fscommand("addFavorite", "http://www.flash8.net|闪吧");
}
然后在发布设置中选择flash with fscommand,发布成html
2,修改html:
找到
// Handle all the the FSCommand messages in a Flash movie
function sethomepage_DoFSCommand(command, args) {
}
这一段,修改成:
// Handle all the the FSCommand messages in a Flash movie
function sethomepage_DoFSCommand(command, args) {
var sethomepageObj = InternetExplorer ? sethomepage : document.sethomepage;
if (command == "setHomePage") {
document.links[0].style.behavior = "url(#default#homepage)";
document.links[0].setHomePage(args);
} else if (command == "addFavorite") {
args = args.split("|");
window.external.AddFavorite(args[0], args[1]);
}
}
最后,如果html里一个链接都没有,还需在
返回正常效果显示
TextField对象
新的TextField对象是mx的新对象,影片中的所有动态文本字段和输入文本字段都是TextField对象的实例。是从Object对象继承而来,格式如下:
MovieClip.createTextField(Instance名称,深度,初始x轴位置,初始y轴位置,初始宽度,初始高度);
下面列出文本框常用的一些属性:
textfield.autosize--控制文本对齐方式及对应的尺寸。
textfield.background--控制文本的背景色是否显示布尔变量(true,false)。
textfield.backgroundcolor--控制文本的背景色,默认是白色。
textfield._height和textfield._width--文本框的高度与宽度。
textfield.html--控制文本是否为html文本,布尔变量。
textfield.htmltext--html文本串。在文本对象中,html文本串的内容与普通纯文本的内容存放的内容的地方是不同的,他们各自管理自己的内容,互不相干。
textfield.length--返回文本的长度,他的值只能获取,不能设置。
textfield.restrict--指示用户可输入到文本字段中的字符集。
textfield.textcolor--当前文本的颜色。书写形式为0x######。
textfield.tye--文本的类型。
textfield.variable--文本变量名。这个值可以取得,也可以设置。