当前位置: 首页 > 图文教程 > Flash动画 > Flash动画制作 > Flash教程:AS数学课件—推导三角形面积

Flash动画制作
RGB颜色action自定义教程(2) — 随机颜色篇
RGB颜色action自定义教程(3) — 颜色渐变篇
RGB颜色action自定义教程 — 色光叠加篇
实时走动的时钟的制作
在FLASH中弹出网页窗口
Flash高级知识学习:ActionScript扫盲
关于FLASH留言板的详细教程
Flash常见问题解答集锦
Flash MX04文字特效:残影动画
Flash游戏制作常用代码解析
ActionScript图文教程(六)
场景之间相互跳转的实现方法
关于变量的问题
ActionScript图文教程(七)
ActionScript图文教程(八)
ActionScript图文教程(九)
ActionScript图文教程(十)
ActionScript图文教程(十一)
遮罩效果的动态文本
ActionScript图文教程(十二)

Flash动画制作 中的 Flash教程:AS数学课件—推导三角形面积


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

[思路]

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

[演示]

看不到动画效果的朋友请去这里观看:http://bbs.ruanchen.com/"gadspro">

[过程]

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、把上面元件拖入到主场景中合适的位置。