stop();var dep:Number = 0;hitMc_arr = ["xlzHit", "hqzHit", "xxzHit", "xhzHit", "dmzHit"];//要碰撞的mc實(shí)例名xlz_arr = [];//笑臉組的分?jǐn)?shù)hqz_arr = [];//紅旗組的分?jǐn)?shù)xxz_arr = [];//略xhz_arr = [];//dmz_arr = [];////函數(shù)調(diào)用復(fù)制正(xlz,xlz_arr,xlz_txt);復(fù)制正(hqz,hqz_arr,hqz_txt);復(fù)制正(xxz,xxz_arr,xxz_txt);復(fù)制正(xhz,xhz_arr,xhz_txt);復(fù)制正(dmz,dmz_arr,dmz_txt);復(fù)制負(fù)(kf_mc);//函數(shù)定義function 復(fù)制正(mc, _arr, t){ mc.n = 0; mc.onRollOver = function() { this.n++; dep++; trace(dep); var newMc:MovieClip = this.duplicateMovieClip(this._name + this.n, dep); trace(newMc); 拖動(dòng)(newMc,_arr,t); };}function 拖動(dòng)(mc:MovieClip, _arr:Array, t:TextField){ mc.onPress = function() { this.startDrag(); }; mc.onRelease = mc.onReleaseOutside = function () { this.stopDrag(); //向分?jǐn)?shù)數(shù)組中增加1 t.text = 計(jì)分(_arr, 10); };}function 復(fù)制負(fù)(mc){ mc.n = 0; mc.onRollOver = function() { this.n++; dep++; //trace(dep); var newMc:MovieClip = this.duplicateMovieClip(this._name + this.n, dep); //trace(newMc); 拖動(dòng)負(fù)(newMc); };}function 拖動(dòng)負(fù)(mc){ mc.onPress = function() { this.startDrag(); }; mc.onRelease = mc.onReleaseOutside = function () { this.stopDrag(); //向分?jǐn)?shù)數(shù)組中增加1 碰撞(mc); };}function 計(jì)分(_arr:Array, fen:Number){ _arr.push(fen); //trace("分?jǐn)?shù)數(shù)組是:" + _arr); temp = 0; for (var _i in _arr) { temp += _arr[_i]; } //trace("temp是" + temp); return temp;}function 碰撞(mc){if (mc.k == undefined){mc.k = 0;}mc.k++;for (var _i in hitMc_arr){if (mc.hitTest(_root[hitMc_arr[_i]])){//trace(_root[hitMc_arr[_i]] + "撞了");lb = _root[hitMc_arr[_i]]._name.substring(0, 3);if (mc.k == 1){//向分?jǐn)?shù)數(shù)組中增加-1llb = _root[lb + "_arr"];lbt = _root[lb + "_txt"];//trace(lbt);lbt.text = 計(jì)分(llb, -10);}}}}
為什么進(jìn)入下一個(gè)場(chǎng)景以后第一個(gè)場(chǎng)景手動(dòng)的元件拖動(dòng)仍然顯示?
UYOU
2023-04-02 17:13:48