我定義了一個函數,並嘗試運行它,但它不會運行,如果我把代碼從函數運行良好,我不能解決爲什麼,這裏是在功能和來電...Actionscript 2:函數將不會運行
function Boomclat() {
var TweenX:Tween = new Tween(this, "_x", mx.transitions.easing.Strong.easeOut, this._x, 16.9, 1, true);
var TweenY:Tween = new Tween(this, "_y", mx.transitions.easing.Strong.easeOut, this._y, listY, 1, true);
}
Boomclat();
這裏是我的整個代碼(在此MC,還有更多外):
onClipEvent (load) {
import mx.transitions.Tween;
import mx.transitions.easing.*;
startX = this._x;
startY = this._y;
mn = 0;
}
onClipEvent (enterFrame) {
this.onRollOver = function() {
this.gotoAndStop("over");
};
this.onRollOut = function() {
this.gotoAndStop("up");
};
this.onPress = function() {
this.gotoAndStop("down");
};
this.onReleaseOutside = function() {
this.gotoAndStop("up");
};
this.onRelease = function() {
this.gotoAndStop("up");
this.enabled = false;
this.arrow.gotoAndStop("ordered");
if (_global.hasAnswered != 1) {
this.arrow.listNumber = this._parent.Order.length+1;
listY = 35+(74.9*this._parent.Order.length);
this._parent.Order.push(this);
function Boomclat() {
var TweenX:Tween = new Tween(this, "_x", mx.transitions.easing.Strong.easeOut, this._x, 16.9, 1, true);
var TweenY:Tween = new Tween(this, "_y", mx.transitions.easing.Strong.easeOut, this._y, listY, 1, true);
};
Boomclat();
this._parent.buttonHolder.previousOrder.push(this);
} else {
for (i=0; i<this._parent.trueOrder.length; i++) {
if (this == this._parent.trueOrder[i]) {
_global.previousButton.enabled = true;
_global.previousButton.gotoAndStop("up");
myColor = new Color(_global.previousButton);
myColor.setTint(255,255,255,0);
myColor = new Color(this);
myColor.setTint(113,205,0,23);
this.gotoAndStop("down");
var TweenX:Tween = new Tween(_global.lastText, "_x", mx.transitions.easing.Back.easeOut, 276.4, -210, 0.7, true);
_global.whichText = this._parent.textFile[i];
var TweenX:Tween = new Tween(_global.whichText, "_x", mx.transitions.easing.Back.easeOut, 760, 276.4, 0.7, true);
_global.lastText = whichText;
_global.previousButton = this;
}
}
}
};
}
任何人都可以看到什麼是錯的?乾杯。
這不是一個答案,但我認爲你不應該在enterFrame事件中有onRelease等的定義。你只需要運行這些代碼,enterFrame就會重複執行很多次(例如24 fps每秒24次)。 – 2011-05-19 15:56:11
確實,他們認爲他們需要持續不斷地識別翻車等,顯然不是歡呼。 – 2011-05-19 15:59:10