0

我希望有人可以帮助我解决我试图将我创建的谜题中的 as3 代码集成到我的游戏 FLA 文件中的问题。

在 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);
    }

//拼图的更多功能

4

1 回答 1

2

这个函数有一个参数:

public function getword(passed_class:Engine) {
        main_class = passed_class;
        words=["cat","dog"];
        current_word=words[ques_num];
        setTiles(current_word.length);
        ques_num++;
    }

在第 132 行,您没有传递参数,因此这就是错误消息的原因。

于 2013-04-05T22:41:30.527 回答