数学课件:用Flash AS推导三角形面积-Flash教程

来源:闪吧论坛 作者:qinz 更新时间:2008-03-04 点击:

[思路]

先创建一个三角形,然后复制一个并旋转移动与原图拼成一个平行四边形,平行四边形面积=底×高,所以三角形面积=底×高÷2。

[演示]

[过程]

1、创建一个影片剪辑,在帧上写如下代码:

this.createEmptyMovieClip(\"sjx0\", 1);
with (sjx0) {
lineStyle(2, 0x000000);
beginFill(0xFF0000);
moveTo(0, 0);
lineTo(0, 0);
lineTo(60, 100);
lineTo(-100, 100);
}
duplicateMovieClip(sjx0, \"sjx1\", 2);
sjx1._x = 0;
sjx1._y = 0;
my_txt.text = \"\";
sjx1.onEnterFrame = function() {
delete this.onRelease;
if (this._rotation<180) {
this._rotation = 5;
} else {
this._rotation = 0;
if (this._y<100) {
this._y = 5;
this._x = 3;
}
if (this._y == 100) {
this._y = 0;
this._x = 0;
createTextField(\"my_txt\", 3, 50, 20, 80, 20);
my_txt.text = \"点击重来\";
my_txt.selectable = false;
my_txt.autoSize = true;
my_txt.textColor = 0xFFFFFF;
this.onRelease = function() {
my_txt.text = \"\";
this._x = 0;
this._y = 0;
this._rotation = 0;
};
}
}
};

2、把上面元件拖入到主场景中合适的位置。

相关Flash教程:
最新评论:
loading.. 评论加载中....
发表评论:不能超过250字节,请自觉遵守互联网相关政策法规.
  • 昵称: 验证:

最新Flash教程