當我調試項目,我被接到222個報警,它僅包含兩個警告:如何修復Adobe Animate CC AS3中的警告1082(遷移問題)和1008?
Warning: 1082: Migration issue: Method %s will behave differently in ActionScript 3.0 due to the change in scoping for the this keyword. See the entry for warning 1083 for additional information.
而另一個問題:
Warning: 1008: return value for function '%s' has no type declaration
然後,我提供了一個screenshot of warnings。我找到了它的解決方案,尤其是我不知道什麼。我讀了約Warning: 1082: Migration issue
,它說,從AS2導入到AS3,但在我的情況下,我從來沒有使用AS2。是的,我從另一個文件導入代碼,但在AS3中。我該如何解決這些錯誤?任何想法如何解決它?任何建議或幫助將不勝感激。謝謝!
編輯:
這裏是我的代碼在我的AS文件:
package {
import flash.display.*;
import flash.text.*;
import flash.events.Event;
import flash.display.MovieClip;
import flash.events.MouseEvent;
public class Main extends MovieClip {
public var mainmenu: MainMenu = new MainMenu();
public var scrollinstructwin: ScrollInstructWin = new ScrollInstructWin();
public var startopt: StartOpt = new StartOpt();
public var learnopt: LearnOpt = new LearnOpt();
public var newload: NewLoad = new NewLoad();
public var propocon: PropoCon = new PropoCon();
public var setcon: SetCon = new SetCon();
public var relationcon: RelationCon = new RelationCon();
public var scrollstorywin: ScrollStoryWin = new ScrollStoryWin();
public function Main() {
super();
addChild(mainmenu);
mainmenu.x = 350;
mainmenu.y = 290;
mainmenu.btnStart.addEventListener(MouseEvent.CLICK, start);//warning 1082
mainmenu.btnInstruct.addEventListener(MouseEvent.CLICK, instruct);
}
public function start(event: MouseEvent) {//warning 1008
removeChild(mainmenu);
addChild(startopt);
startopt.x = 350;
startopt.y = 290;
startopt.btnLearn.addEventListener(MouseEvent.CLICK, learn);
startopt.btnPlay.addEventListener(MouseEvent.CLICK, laro);
startopt.btnBack.addEventListener(MouseEvent.CLICK, back);
}
public function instruct(event: MouseEvent) {
removeChild(mainmenu);
addChild(scrollinstructwin);
scrollinstructwin.x = 36.20;
scrollinstructwin.y = 21.50;
scrollinstructwin.btnGi.addEventListener(MouseEvent.CLICK, gi);
}
public function gi(event: MouseEvent) {
removeChild(scrollinstructwin);
addChild(mainmenu);
}
public function back(event: MouseEvent) {
removeChild(startopt);
addChild(mainmenu);
}
public function learn(event: MouseEvent) {
removeChild(startopt);
addChild(learnopt);
learnopt.x = 350;
learnopt.y = 290;
learnopt.btnPropo.addEventListener(MouseEvent.CLICK, propo);
learnopt.btnSets.addEventListener(MouseEvent.CLICK, sets);
learnopt.btnRelations.addEventListener(MouseEvent.CLICK, relations);
learnopt.btnBack3.addEventListener(MouseEvent.CLICK, backo);
}
public function laro(event: MouseEvent) {
removeChild(startopt);
addChild(newload);
newload.x = 350;
newload.y = 290;
newload.btnNew.addEventListener(MouseEvent.CLICK, neww);
newload.btnBack2.addEventListener(MouseEvent.CLICK, backu);
}
public function backo(event: MouseEvent) {
removeChild(learnopt);
addChild(startopt);
}
public function neww(event: MouseEvent) {
removeChild(learnopt);
addChild(scrollstorywin);
scrollstorywin.x = 51.15;
scrollstorywin.y = 30.05;
}
public function backu(event: MouseEvent) {
removeChild(newload);
addChild(startopt);
}
public function propo(event: MouseEvent) {
removeChild(learnopt);
propocon.gotoAndStop(1);
addChild(propocon);
propocon.x = 414.80;
propocon.y = 218.60;
propocon.btnExit.addEventListener(MouseEvent.CLICK, byeol);
}
public function byeol(event: MouseEvent) {
removeChild(propocon);
addChild(learnopt);
}
/*propocon.btnBtm.addEventListener(MouseEvent.CLICK, byl);
public function byl(event: MouseEvent) {
removeChild(propocon);
addChild(learnopt);
}*/
public function sets(event: MouseEvent) {
removeChild(learnopt);
addChild(setcon);
setcon.x = 412.45;
setcon.y = 225.00;
}
public function relations(event: MouseEvent) {
removeChild(learnopt);
addChild(relationcon);
relationcon.x = 400.00;
relationcon.y = 225.00;
}
}
}
我已經在評論1082警告之一,1008你認爲什麼是這些警告的原因是什麼?謝謝!
有這麼多的警告,沒有代碼檢查。 我認爲你應該提供一些代碼部分,否則很難指出我們的問題。 您能否澄清您的問題並將代碼添加到您收到警告的地方? – tatactic
我的代碼很長,我會在這裏上傳一個文件。 – Cathreen
鏈接錯誤。 只需發佈警告選項卡中提到的行,並附上一些解釋。 閱讀堆棧溢出的幫助標籤,瞭解如何格式化代碼! – tatactic