[前言]
高手莫看,给初学者。
[步骤]
第一步:创建影片剪辑元件,画个小球,拖到主场景中,实例名为_mc
第二步:创建按钮元件,画一个按钮,拖到主场景中,实例名为_btn
第三步:在主场景中的第一帧上写代码:
var i:Number = 0;
_btn.onRelease = function() {
i++;
if (i%2 == 1) {
_mc.onEnterFrame = function() {
this._x -= 10;
if (this._x=570) {
this._x = -20;
}
};
}
};—————————————————或者———————————————————
_btn.onRelease = function() {
this.id = !this.id;
if (this.id) {
_mc.onEnterFrame = function() {
this._x -= 10;
if (this._x = 570) {
this._x = -20;
}
};
}
};看看效果:
本文转自:http://www.5uflash.com/flashjiaocheng/Flashyingyongkaifa/153.html
高手莫看,给初学者。
[步骤]
第一步:创建影片剪辑元件,画个小球,拖到主场景中,实例名为_mc
第二步:创建按钮元件,画一个按钮,拖到主场景中,实例名为_btn
第三步:在主场景中的第一帧上写代码:
var i:Number = 0;
_btn.onRelease = function() {
i++;
if (i%2 == 1) {
_mc.onEnterFrame = function() {
this._x -= 10;
if (this._x=570) {
this._x = -20;
}
};
}
};—————————————————或者———————————————————
_btn.onRelease = function() {
this.id = !this.id;
if (this.id) {
_mc.onEnterFrame = function() {
this._x -= 10;
if (this._x = 570) {
this._x = -20;
}
};
}
};看看效果:
本文转自:http://www.5uflash.com/flashjiaocheng/Flashyingyongkaifa/153.html
本文为初学者介绍如何使用Flash创建一个可以左右移动的小球动画。通过创建影片剪辑和按钮元件,并编写简单的ActionScript代码实现小球的自动水平移动效果。
1612

被折叠的 条评论
为什么被折叠?



