0
我希望有人可以帮我解决一个问题,我试图将我创建的谜题集成到我的游戏FLA文件中。AS3 OOP继承和功能
在Game.fla中,我有一个名为Engine的主类,它包含从库中调用一些空的影片剪辑到舞台,然后使用库中的资源填充每个影片剪辑。每个影片剪辑都有自己的类与它关联。
我已经创建每个拼图在一个单独的文件与自己的主类来测试并确保拼图的工作,当我尝试添加一个拼图的代码到一个动画片类我得到一些错误
输出错误
**Warning** The linkage identifier 'feedback2' was already
assigned to the symbol 'wrong_box', and cannot be assigned
to the symbol 'graphics/scrambleAssets/wrong_box',
since linkage identifiers must be unique.
和编译器错误
Line 132 1136: Incorrect number of arguments. Expected 1.
线132是这样的:
if(ques_num==words.length){removeChild(checker);
f3=new feedback3;
addChild(f3);
f3.x=100;
f3.y=100;
}else{
getword();}
主类
public function show_level1Puzzle(){
level1Puzzle_screen = new level1Puzzle(this);
remove_levelChooseBoy();
addChild(levelPuzzleBoy_screen);
level1Puzzle_screen.x=510;
level1Puzzle_screen.y=380;
}
**类为level1Puzzle **
package actions {
import flash.display.MovieClip;
public class level1Puzzle extends MovieClip {
public var main_class:Engine;
// variables used in puzzle
var words:Array = new Array;
Var rand1:int;var rand2:int;
var i:int; //variable used for loop iterations
// more variables
public function level1Puzzle(passed_class:Engine) {
main_class = passed_class;
public function getword(passed_class:Engine) {
main_class = passed_class;
words=["cat","dog"];
current_word=words[ques_num];
setTiles(current_word.length);
ques_num++;
}
public function setTiles(a) {tileArray=[ ];
for(i=0;i<a;i++){
var tempclip:Tile =new Tile;addChild(tempclip);
tempclip.x=300+(i*180);tempclip.y=200;tempclip.tag=i;
tempclip.original_posx=tempclip.x;
tempclip.original_posy=tempclip.y;
tileArray[i]=tempclip;
var tempclip2:Placeholder =new Placeholder;addChild(tempclip2);
tempclip2.x=300+(i*180);tempclip2.y=400;
targetArray[i]=tempclip2;
}//for i
scramble_word(a);
}
//多为拼图
函数
正确的,我应该更好地说明了参数“checker”涉及到一个按钮,我已经在引擎类中声明它 var checker = new button_chk; leve1Puzzle_screen.addChildAt(checker,1); 但它抛出未定义的属性错误...如果我在level1 Puzzle类中声明它,我得到相同的未定义的属性错误 – daveQuinn 2013-04-05 23:12:42
行132 1136:不正确的参数数量。预期1 - 我回答的是固定的。这是一个问题和答案论坛,它不是由问题论坛调试您的代码问题。如果出现新问题,请就这一特定问题开始一个新问题。 – prototypical 2013-04-06 01:04:59