School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 300,421 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,527 people online right now. Registration is fast and FREE... Join Now!




setInterval trouble

 

setInterval trouble, Not understanding "Error #1063: Argument count mismatch

DigitalMonk

25 Jun, 2009 - 08:20 AM
Post #1

New D.I.C Head
*

Joined: 16 Jun, 2009
Posts: 5


My Contributions
CODE

var count:Number = 0;
trace(count);

function countUp(e:Event) {
    count++;
    trace(count);
}
setInterval(countUp, 2000);
trace("bottom");


I'm converting from AS2 > AS3 a lower-third graphic for TV that dynamically pulls text via XML . It's for a school board meeting video broadcast. The XML text is meeting agenda subject line and subject descrption from a 3rd party program. No troubles here.

problem is I used setInterval in AS2 to refresh the dynamic text fields.

Not having luck out of the gates with setInterval in AS3, so I am trying to create the simple code attached to see what I'm missing. The error in the output panel is:

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

--------

The ArgumentError line continues to repeat until I close the movie.

What am I missing on the "count mismatch" stuff?

I picked up AS2 in '06, and lucky for me sad.gif everything changed to AS3 right when I left school. The transition to AS3 has been annoyingly painful to say the least, so be kind as you pick apart my not so optimized and most probably worst practice coding attempt.

I'm a video guru and knew nothing of OOP before starting AS2. Any suggestions are greatly appreciated.

Jeff

Mod edit - Please code.gif

User is offlineProfile CardPM
+Quote Post


SoLi

RE: SetInterval Trouble

27 Jun, 2009 - 03:38 AM
Post #2

andydust.com
*****

Joined: 27 Jan, 2002
Posts: 1,428



Thanked: 35 times
My Contributions
You have specified that your countUp function should take an Event object as an argument, however not only do you not pass an Event object to the function in your setInterval, no Events are actually ever dispatched in this program.

You can fix your code by removing the argument from the function, leaving your code as so:

CODE

var count:Number = 0;
trace(count);

function countUp() {
    count++;
    trace(count);
}
setInterval(countUp, 2000);
trace("bottom");


User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/8/09 12:10AM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month