ArgumentError: Error #1063: Argument count mismatch on banner/directoryFocusOut(). Expected 0, got 1.

ArgumentError: Error #1063: Argument count mismatch on banner/directoryFocusOut(). Expected 0, got 1.

I received this error when an event handler I created did not contain an expected parameter. Somehow the compiler missed it but an error was thrown in the browser. The fix was easy. I forgot to add in the event object. Adding that in fixed the problem.

directorySearch_txt.addEventListener(FocusEvent.FOCUS_OUT, directoryFocusOut);

// this line generated no errors in flex but generated errors at run time
public function directoryFocusOut():void {
     // do something	
}

// adding the event object cleared the error
public function directoryFocusOut(event:FocusEvent):void {
     // do something	
}

Please reply in the comments below if this helped you or not. You can also use the Error Lookup Tool to look up Flex compiler or runtime errors. more info…

This entry was posted in Flex. Bookmark the permalink.

38 Responses to ArgumentError: Error #1063: Argument count mismatch on banner/directoryFocusOut(). Expected 0, got 1.

  1. JabbyPanda says:

    Are you writing own version of LiveDocs? ;)

    Anyway, I appreciate your effors, I kinda receive this error too often with my custom Events too :)

  2. Judah says:

    Yes. :)
    I use the live docs but do not think their error section is very thorough. Plus sometimes I would like an answer in plain English to help myself when I get an error and am not thinking clearly. :)

  3. Len says:

    Thanks so much! That error was so vague!

  4. Mikael says:

    thanks a lot! my script had the same problem…. works now :) appreciate it!

  5. nomad says:

    THANKS!!

  6. ddlam says:

    Thanks, same case I had

  7. starrfall says:

    thanks, really helpful information:)

  8. Anonymous says:

    Yeah, thanks, wasted 4 hours of my life to locate the error, damn Flash

  9. Sara says:

    thanks, really helpful information:)

  10. YoS says:

    Great! solved my problem in a sec!

  11. Don says:

    Wow, thank you very much for this post.

    Knocked my head against the wall until i found this…. seriously

    Thanks!

  12. yAsIr says:

    Hi,
    This is very helpful to all people like me, new in flex.
    Thanx a lot

  13. John says:

    This was EXTREMELY helpful. Doh!!

    Thanks for taking the time post. Sweet:)

  14. skinnyBlimp says:

    Very helpful for a pseudo coder like myself. Thanks!

  15. clint says:

    thanks so much, worked like a charm

  16. amar shukla says:

    thanx . it really helped to solve the problem . Nice work !

    !Amar Shukla!

  17. ZAC says:

    thanks a lot !! you’ve helped me solve a problem!!!

  18. Eric says:

    Can also happen with a class constructor that wants arguments, but underlying code needs to create objecs without arguments (i.e. using remote objects):

    THIS DOESN’T WORK:
    private var name:String;
    public function Foo(name:String):Foo {
    _name=name;
    }

    THIS DOES WORK:
    private var name:String;
    public function Foo() {}
    public static function createFoo(name:String):Foo {
    trace(name);
    var foo:Foo=new Foo();
    foo.name=name;
    return foo;
    }

  19. arthipesa says:

    btw, that pain could also be solved by below example

    public function fncname(evt:Event = null){
    // your code here..
    }

  20. Yes, simple problem, but it can take you some time if you’re not sure what it is.

  21. cypher says:

    Thank you, you solved my problem. ;-)

  22. Daniel Dourado says:

    Thank you so much, solved my problem!

  23. handoyo says:

    Thanks a lot,it solved my problem…

  24. Renan JC says:

    Thank you guy
    a lot
    it’s solved my problem
    i don’t know if you will understand me, but how we say in Brazil:

    TU É FODA MERMÃO!!

  25. Benjamin says:

    Hey there. I got this error from calling a function located on the stage from within a child on the main stage. Adding the event object not only doesn’t remove the error, but also prevents the function from working at all. Currently it doesn’t affect the code, but the fact that the error is persistant does annoy me.

    Here is my function on the stage (yes this code is for a Flash-based RPG):
    function attack(event:Event):void {
    var playerDamage = playerStrength – enemyDefence;
    var enemyCurrentHealth = enemyHealth – playerDamage;
    //Player HP
    enemyHealth -= playerDamage;
    trace(“The enemy’s health is “+enemyCurrentHealth);
    enemyHP.text = String(enemyCurrentHealth);

    //Play victory screen
    if (enemyHealth

  26. Jude says:

    Thanks for this info…. It was very helpful……

  27. Mick says:

    Thankyou!

  28. Patrick says:

    ArgumentError: Error #1063: Argument count mismatch on 01_intro_fla::MainTimeline/dynotex(). Expected 0, got 1.

    my code is……btnResolution.addEventListener(MouseEvent.ROLL_OVER, dynotex);
    function dynotex() {
    definition.text = “RESOLUTION is blah di blah….2 lines of sample dynamic text”
    }

    Im tryn to pull some dyno txt i keep gettin the same error

  29. yowlong says:

    Thanks! Your fix is a godsend, I was annoyed by this error and was about to gave up!

  30. djsquared says:

    Such a great and easy fix. Thank you!!!!

  31. Tek says:

    Such a helpful and easy fix. Just what I needed, thank you.

  32. mottatta says:

    Thanks dude you’ve saved my life :P

  33. Dan says:

    exactly what I needed. Thanks!

  34. Someoano says:

    Thanks alot :) that saved me hours of searching :)

  35. Tb9 says:

    Thanks!
    Saved me from lots of befuddlement.

  36. marcesim says:

    Hey!.. thanks, very easy the workaround and easy to understand.
    That’s the most important I think.

Leave a Reply

Your email address will not be published. Required fields are marked *

Wrap your code before posting! Click the links below:

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="">