Im trying to add an extra movieclip to stage with this code, i want an extra movieclip added every 10 seconds..
This error shows up:
ArgumentError: Error #1063: Argument count mismatch on Untitled_fla::MainTimeline/fl_EnterFrameHandler(). Expected 1, got 0.
Please help me someone
There are a few things you do not want with the code you show.
1) You do not want the ENTER_FRAME event listener. That will call the fl_EnterFrameHandler function at the frame rate of your file.
2) Using addChild() is not how you add new objects, it is only how you add objects to the display list. You need to create the new object instances, such as in...
var newObj:MC = new MC(); // where MC is whatever class name you assign to the MovieClip
and then you can use addChild(newObj) to add the object to the display list.
The way you have it now, it will simply keep moving the same object to the top of the display.
3) The error you are getting is because your function is expecting an argument to be passed to it, which the ENTER_FRAME listener provides, but the setInterval does not. If you get rid of the ENTER_FRAME listener, then you just need to change the function definition line to be...
Just for future consideration, if there is an instance where you need to call a function that a listener also calls, but you do not have an Event argument to pass to the function, then you can accomodate that scenario by nulling the argument in the function definition line...