专注于互联网--专注于架构

最新标签
网站地图
文章索引
Rss订阅

首页 »Flash教程 » flash按钮:介绍Flash中按钮控制小球左右滚动的两种写法 »正文

flash按钮:介绍Flash中按钮控制小球左右滚动的两种写法

来源: 发布时间:星期五, 2009年1月23日 浏览:23次 评论:0
  [前言]

  高手莫看给初学者

  [步骤]

  第步:创建影片剪辑元件画个小球拖到主场景中例子名为_mc

  第 2步:创建按钮元件个按钮拖到主场景中例子名为_btn

  第 3步:在主场景中帧上写代码:

vari:Number=0;
_btn.onRelease=function{
i;
(i%21){
 _mc.onEnterFrame=function{
 this._x-=10;
 (this._x<=-20){
  this._x=570;
 }
 };
}
(i%20){
 _mc.onEnterFrame=function{
 _mc._x10;
 (this._x>=570){
  this._x=-20;
 }
 };
}
};


  —————————————————或者———————————————————

_btn.onRelease=function{
this.id=!this.id;
(this.id){
 _mc.onEnterFrame=function{
 this._x-=10;
 (this._x<=-20){
  this._x=570;
 }
 };
}
(!this.id){
 _mc.onEnterFrame=function{
 _mc._x10;
 (this._x>=570){
  this._x=-20;
 }
 };
}
};


  看看效果:



相关文章

读者评论

发表评论

  • 昵称:
  • 内容: