高手莫看,給初學者。
[步驟]
第一步:創建影片剪輯元件,畫個小球,拖到主場景中,實例名爲_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