Flash AS实例:神奇的数字魔术盒子_Flash教程
教程Tag:暂无Tag,欢迎添加,赚取U币!
推荐:Flash cs3转换位图为矢量图本例为Flash CS3仿真艺术设计系列教程,有兴趣的朋友请关注本系列教程,本文我们将学习如何在Flash cs3中将位图转换成矢量图。 转换位图为矢量图 摄影图片过去习惯被用于各种flash方案的写实措施。他们能在初始阶段被导入和使用。或者他们能作为一个特别的简
应闪友要求制作一个数学小实例,名字好大,其实很小。/*
神奇的魔盒
by sxl001 QQ:285510591
*/
stop();
mc.t.restrict = ". 0-9";
//限制输入只能为数字
//go 出盒数字控制 i 排列位置用 v 运动速度
var go:Boolean = false, i:Number = 0, v:Number = 10;
t1.text = "开始";
btn.onPress = function() {
//开始按钮
if (mc.t.text != "") {
btn._visible = false;
t1.text = "";
v = 10;
var j:Number = i 1;
//this["m" i] this["m" j] 调出库中m作为出盒数字载体
this["m" i] = attachMovie("m", "m" i, _root.getNextHighestDepth());
this["m" j] = attachMovie("m", "m" j, _root.getNextHighestDepth());
mask.swapDepths(_root.getNextHighestDepth());
//遮隹出盒数字
this["m" i]._x = 260;
//出盒数字位置
this["m" j]._x = 260;
this["m" i]._y = 220;
this["m" j]._y = 220;
var num:Number = Number(mc.t.text);
//取得输入数字
this["m" i].t.text = num;
this["m" j].t.text = 2*num;
//2倍
run(mc, 240, 190, this["m" i], this["m" j]);
//移动进盒数
go = true;
}
};
function run(target:MovieClip, endx:Number, endy:Number, target1:MovieClip, target2:MovieClip) {
target.onEnterFrame = function() {
var disx:Number = (endx-this._x)/v;
var disy:Number = (endy-this._y)/v;
this._x = disx;
this._y = disy;
if (Math.abs(this._x-endx)<=1) {
this._x = endx;
this._y = endy;
delete this.onEnterFrame;
if (go) {
v = 5;
//移动出盒的两个数
run(target1, 410, endy-100 i*30);
run(target2, 480, endy-100 i*30);
go = false;
i ;
} else {
back_btn._visible = true;
t2.text = "再来";
}
}
};
}
back_btn._visible = false;
back_btn.onPress = function() {
this._visible = false;t2.text = "";
mc.t.text = "";
mc._x = 90;
//输入文本框归位
mc._y = 192;
btn._visible = true;
t1.text = "开始";
};
神奇的魔盒
by sxl001 QQ:285510591
*/
stop();
mc.t.restrict = ". 0-9";
//限制输入只能为数字
//go 出盒数字控制 i 排列位置用 v 运动速度
var go:Boolean = false, i:Number = 0, v:Number = 10;
t1.text = "开始";
btn.onPress = function() {
//开始按钮
if (mc.t.text != "") {
btn._visible = false;
t1.text = "";
v = 10;
var j:Number = i 1;
//this["m" i] this["m" j] 调出库中m作为出盒数字载体
this["m" i] = attachMovie("m", "m" i, _root.getNextHighestDepth());
this["m" j] = attachMovie("m", "m" j, _root.getNextHighestDepth());
mask.swapDepths(_root.getNextHighestDepth());
//遮隹出盒数字
this["m" i]._x = 260;
//出盒数字位置
this["m" j]._x = 260;
this["m" i]._y = 220;
this["m" j]._y = 220;
var num:Number = Number(mc.t.text);
//取得输入数字
this["m" i].t.text = num;
this["m" j].t.text = 2*num;
//2倍
run(mc, 240, 190, this["m" i], this["m" j]);
//移动进盒数
go = true;
}
};
function run(target:MovieClip, endx:Number, endy:Number, target1:MovieClip, target2:MovieClip) {
target.onEnterFrame = function() {
var disx:Number = (endx-this._x)/v;
var disy:Number = (endy-this._y)/v;
this._x = disx;
this._y = disy;
if (Math.abs(this._x-endx)<=1) {
this._x = endx;
this._y = endy;
delete this.onEnterFrame;
if (go) {
v = 5;
//移动出盒的两个数
run(target1, 410, endy-100 i*30);
run(target2, 480, endy-100 i*30);
go = false;
i ;
} else {
back_btn._visible = true;
t2.text = "再来";
}
}
};
}
back_btn._visible = false;
back_btn.onPress = function() {
this._visible = false;t2.text = "";
mc.t.text = "";
mc._x = 90;
//输入文本框归位
mc._y = 192;
btn._visible = true;
t1.text = "开始";
};
分享:Flash CS4教程:3D旋转和3D位移Flash CS4的3D工具很容易上手。在工具栏里有两个处理3D变形的工具:3D旋转和3D位移。 这两个工具都可以切换全局坐标模式和个体坐标模式,上图为个体坐标模式。 另外,也可以通过属性面板和变形面板来调整3D变形的参数。其中值得注意的是灭点(消失点)和相机
相关Flash教程:
- 相关链接:
- 教程说明:
Flash教程-Flash AS实例:神奇的数字魔术盒子。