05.25.07

Flash CS3 / Flex Error Messages – Error #1063:

Posted in errors, Flash at 12:00 am by Curtis J. Morley

ArgumentError: Error #1063: Argument count mismatch on com.cjm::DrawLines/::onEnterFrame(). Expected 0, got 1.

This is an easy one it means that you got an argument passed to your function yet you did not specify that one was coming. So you did this "function Bob ()" instead of "function Bob (myEvent:Event)" This error is common when dealing with Events.

18 Comments »

  1. yarkehsiow said,

    December 20, 2007 at 9:25 pm

    Thank you so much for this.
    I’m just learning AS3, and found a few other similar pages which did not answer the question. then I stumbled over here…
    I appreciate the straightforward approach!

  2. Jeff said,

    January 13, 2008 at 9:59 pm

    Thanks! This helped.

  3. Bas said,

    June 12, 2008 at 4:20 pm

    This was just what I needed, thanks!

  4. j said,

    June 25, 2008 at 6:15 am

    thanks!

  5. Curtis J. Morley said,

    June 26, 2008 at 12:42 pm

    Yark, Jeff, Bas, and j,

    Glad this helped. Events can sometimes be tricky.

    Thanks,
    Curtis J. Morley

  6. Tetsu said,

    July 25, 2008 at 12:00 pm

    This just helped solve a coding problem that I’ve been working on for 2 hours. Thanks so much, Mr.Morley!!

  7. Curtis J. Morley said,

    July 26, 2008 at 9:45 pm

    Tetsu.

    どういたしまして. Let me know what else I can do for you.

    Thanks,

    Curtis J. Morley

  8. Meet said,

    January 13, 2009 at 10:22 pm

    This helped. Thanks much!!!!

  9. ryeanne said,

    January 27, 2009 at 5:22 pm

    help me with this error:

    ArgumentError: Error #1063: Argument count mismatch on mx.core::CrossDomainRSLItem(). Expected 5, got 6.
    at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::initialize()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\managers\SystemManager.as:1825]
    at mx.managers::SystemManager/initHandler()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\managers\SystemManager.as:2904]

  10. Curtis J. Morley said,

    January 27, 2009 at 9:41 pm

    Ryeanne,

    It sounds like you have 1 to many arguments . Your Flex Function is getting 6 & it only wants 5.

    If you need more help please put the errant code in your next comment.

    Thanks,

    Curtis J. Morley

  11. paul said,

    February 6, 2009 at 10:07 am

    muchas gracias, Curtis !

  12. Curtis J. Morley said,

    February 6, 2009 at 9:48 pm

    de nada Paul.

  13. Matt said,

    February 11, 2009 at 9:15 pm

    Can you assist with this senario…
    Im attempting to call the SWFLoad Function from the root… (SWFLoad is the function in the root that will preload each external SWF when its called.)
    The Error Im getting is saying that the Argument expects 2 and is only getting 1. Thanks in advance!! Here is my code:

    import flash.xml.*;
    import flash.text.*;
    import flash.events.Event;
    import flash.display.Loader;
    import flash.net.URLRequest;
    import fl.transitions.Tween;
    import fl.transitions.easing.*;

    // === XML News Slider Script =====================================================================================

    //Declares arrays to insert XML Data
    var date_arr:Array = [];
    var title_arr:Array = [];
    var description_arr:Array = [];
    var image_arr:Array = [];
    var url_arr:Array = [];
    var imageClips_arr:Array = [];

    //Creates XML Loader & List
    //XML Loader
    var news_data:XML = new XML();
    var xml_url:String = “xml/topStories.xml”;
    var news_url:URLRequest = new URLRequest(xml_url);
    var newsLoader:URLLoader = new URLLoader(news_url);

    //Misc Needed Variables
    var count:int = 0;
    var activeNews:int = 0;

    // Adds a listener to the loader function telling to call the function once all data is loaded
    newsLoader.addEventListener(Event.COMPLETE, newsLoaded);

    function newsLoaded(e:Event):void {
    news_data = XML(newsLoader.data);

    //XML List from data
    var allNews:XMLList = news_data.*;

    //Tells loader to take all the elements in the XML file and convert them to strings within the arrays.
    for each (var news:XML in allNews) {
    // trace(news);
    date_arr.push(news.date.toString());
    title_arr.push(news.title.toString());
    description_arr.push(news.description.toString());
    image_arr.push(news.image.toString());
    url_arr.push(news.url.toString());
    }
    //Calls the loadImages Function
    loadImages();
    }

    function loadImages():void {
    var toLoad:int = image_arr.length;
    if (count > toLoad – 1) {
    var totalNews:int = title_arr.length;
    var isPlaying:Boolean = true;
    var timer:Timer = new Timer(15000, 0);

    timer.addEventListener(TimerEvent.TIMER, timerListener);

    function timerListener(e:TimerEvent) {
    if (activeNews == totalNews – 1) {
    //Defines Tweening of Alpha properities for image transition
    var alphaTweenOut = new Tween(mc_sliderImg.mc_holder, “alpha”, None.easeNone, 0.4, 1, 1, true);
    loadNews(0);
    } else {
    //Defines Tweening of Alpha properities for image transition
    var alphaTweenOut2 = new Tween(mc_sliderImg.mc_holder, “alpha”, None.easeNone, 0.4, 1, 1, true);
    loadNews(activeNews + 1);
    }
    }
    timer.reset();
    timer.start();

    function loadNews(num:int):void {
    activeNews = num;

    mc_sliderImg.btn_gotoStory.enabled = false;

    mc_sliderImg.mc_holder.addChild(imageClips_arr[num]);

    mc_sliderText.txt_date.text = date_arr[num];
    mc_sliderText.txt_title.text = title_arr[num];
    mc_sliderText.txt_desc.text = description_arr[num];

    mc_sliderImg.btn_gotoStory.enabled = true;

    mc_sliderImg.btn_gotoStory.addEventListener(MouseEvent.CLICK, redirect);

    function redirect(e:MouseEvent):void {
    var url_request:URLRequest = new URLRequest(url_arr[num]);
    (root.loaderInfo.loader.root as Object).SWFLoad(url_request, mc_content);
    }
    }

    // Loads First Story
    loadNews(0);

    } else {

    //Preloads Images from the images array into empty movie clips
    var mc:MovieClip = new MovieClip;
    imageClips_arr.push(mc);

    var img_url:String = “images/” + image_arr[count];
    var loader:Loader = new Loader();
    var request_url:URLRequest = new URLRequest(img_url);

    loader.load(request_url);
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeListener);

    function completeListener(e:Event):void {
    mc.addChild(loader.content);
    }
    count++;
    loadImages();
    }
    }

  14. Jeff said,

    June 25, 2009 at 11:41 am

    [as]
    var count:Number = 0;
    trace(count);

    function countUp(e:Event) {
    count++;
    trace(count);
    }
    setInterval(countUp, 2000);
    trace(“reached_bottom”);
    [/as]

    ——-
    output panel info
    ——-

    0
    reached_bottom
    ArgumentError: Error #1063: Argument count mismatch on setInterval_test_fla::MainTimeline/countUp(). Expected 1, got 0.
    at Function/http://adobe.com/AS3/2006/builtin::apply()
    at ()
    at SetIntervalTimer/onTimer()
    at flash.utils::Timer/_timerDispatch()
    at flash.utils::Timer/tick()
    ArgumentError: Error #1063: Argument count mismatch on setInterval_test_fla::MainTimeline/countUp(). Expected 1, got 0.
    at Function/http://adobe.com/AS3/2006/builtin::apply()
    at ()
    at SetIntervalTimer/onTimer()
    at flash.utils::Timer/_timerDispatch()
    at flash.utils::Timer/tick()

    ——-

    I’m converting a projector file from AS2 to AS3. SetInterval is giving me trouble. I’m trying to write a simple script that will iron out the functionality I need. I’m just not seeing the light here.

    Thanks for the consideration .

  15. Kam said,

    July 15, 2009 at 2:22 am

    Thanks! Very efficient explanation! :D

  16. Ole said,

    July 18, 2010 at 7:29 am

    Hej Curtis,

    I have made a program i AS2 and just started to migrate it to AS3. Oh boy, there are a lot of changes. I am going to buy CS5 very soon.

    Searching clues on Internet I have come across your site here. I already found a lot of help using the error code and your comprehensive notes.

    I am much obliged, thank you very much.
    Thanks,
    Ole, Denmark

  17. Aaron Hager said,

    March 20, 2011 at 10:09 am

    I get this error as well, hopefully someone can help me. Here is the error.

    ArgumentError: Error #1063: Argument count mismatch on Canvas/initialize(). Expected 0, got 1.
    at flash.display::DisplayObjectContainer/addChild()
    at LoaderMain/init()

    Here is “Canvas/initialize()”

    public function initialize() {
    this.addEventListener(Event.ADDED_TO_STAGE, initialize);
    initProjects();
    initCanvas();
    stage.quality=StageQuality.LOW;
    }

    ———-

    Here is LoaderMain/init()

    public function init(e:Event):void {
    addChild(loader.content);
    tmGraphic=TweenMax.to(graphic,5,{alpha:0,delay:3,onComplete:removeGraphic});
    }

    ———–

    This isn’t my code, I am trying to mod a site for a client and having nothing but problems, as soon as I fix one error I get another. This is at least fix #30 so far.

    Thanks.
    Aaron Hager.

  18. Ankit said,

    April 26, 2011 at 7:26 am

    Thanks it really helped..!!!

Leave a Comment

Click Here ok cool kids