1

main.as

package{
    import flash.display.*;
    import flash.events.Event;

    public class main extends MovieClip{

        public function main(){
            changeState(null,"menu");
        }
        public function changeState( CurrentState, NextState){
            if(CurrentState != null){
                removeChild(CurrentState);
            }
            if(NextState == "menu"){
                var mm:mainMenu = new mainMenu(changeState);
                addChild(mm);
            }
            else if(NextState == "game"){
                var g:CollapsingBlocks = new CollapsingBlocks(changeState);
                addChild(g);
            }
            else if(NextState == "exit"){

            }
        }
    }
}

maniMenu.as

package{
    import flash.display.*;
    import flash.events.MouseEvent;
    import flash.events.Event;

    public class mainMenu extends MovieClip{

        var theCallBackFunction:Function;
        public function mainMenu(callBack){
            var btnPlay:mmPlay = new mmPlay();
            btnPlay.addEventListener(MouseEvent.MOUSE_DOWN, btnP_Button);
            btnPlay.x=width/2=btnPlay.width/2;
            btnPlay.y=height/2=btnPlay.height/2;
            addChild(btnPlay);

            var btnExit:mmExit = new mmExit();
            btnExit.addEventListener(MouseEvent.MOUSE_DOWN, btnE_Button);
            btnExit.x=width/2=btnExit.width/2;
            btnExit.y=height/2=btnExit.height/2;
            btnExit.y + btnExit.height + 4;
            addChild(btnExit);

            theCallBackFunction = callBack;
        }
        public function btnP_button(e:MouseEvent){
            theCallBackFunction (this, "game");
            return;
        }
        public function btnE_button(e:MouseEvent){
            theCallBackFunction (this, "exit");
            return;
        }
    }
}

CollapsingBlock.as

..
public function startCollapsingBlocks(callBack) {
..

How to solve this problem? (error 1136), I'm using Flash CS6 version. File of the game is called CollapsingBlocks.fla, main function called startCollapsingBlocks, I'm trying to make here simple Flash game Menu, with 2 buttons (Play and EXIT).

Aleksandr Sinkevič
  • 317
  • 1
  • 4
  • 15

2 Answers2

0

It looks like you're calling some function which wants no arguments, but you're giving it arguments. From your code, the only place it can be is theCallBackFunction (this, "game"); and theCallBackFunction (this, "exit"); , because those are the only runtime references

Check that the value of theCallBackFunction is always a function that wants 2 arguments.

Pranav Hosangadi
  • 23,755
  • 7
  • 44
  • 70
  • @joshua, vindictive downvoting is not appreciated, and extremely childish. That said, in his code he's calling the function using 2 arguments. Hence, check that the function definition doesn't have a typo - defined with no arguments – Pranav Hosangadi Apr 07 '13 at 07:22
  • sorry on this you said he daclares two arguments thats why i down voted mate – joshua Apr 07 '13 at 11:20
-2

0 expected arguments means you added something inside the function bracket's that's not expected example:

    function mainMenu(callBack) //this is a 1 argument expected answer
    function mainMenu();        this expects no expected arguments

Please check where you ask for the function and you will find the function expatiation/arguments should be 0;

otherwise you had define zero perimeters /arguments for this function

joshua
  • 676
  • 1
  • 5
  • 19
  • 0 expected arguments means that the definition is with 0 arguments, and you've called it with one or more arguments than it is defined with. – Pranav Hosangadi Apr 07 '13 at 06:25
  • OP's function is already expecting 0 arguments. Your suggestion says that he should change a function expecting one argument to require none. That is wrong. – Pranav Hosangadi Apr 07 '13 at 07:24
  • the firstline on my answer saids main menu function, that is an example of 1 , the second example shows a function showinfg an example of 0, this function is expection 0, example: bob(); //exactly that just bob(); – joshua Apr 07 '13 at 12:12