Flash AS3 ArgumentError: Error #1063

i get this error in the output of this flash

ArgumentError: Error #1063: Argument count mismatch on Untitled_fla::MainTimeline/onNextClick(). Expected 1, got 0.
      at QuestionForm/completeHandler()
      at flash.events::EventDispatcher/dispatchEventFunction()
      at flash.events::EventDispatcher/dispatchEvent()
      at flash.net::URLLoader/onComplete()

I am trying to make the MovieClip QuestionForm go to the next question ones you pick a answer.

var variables:URLVariables = new URLVariables();

buttonA.addEventListener(MouseEvent.CLICK, onAnswer);
buttonB.addEventListener(MouseEvent.CLICK, onAnswer);
buttonC.addEventListener(MouseEvent.CLICK, onAnswer);
buttonD.addEventListener(MouseEvent.CLICK, onAnswer);

function onAnswer(e:MouseEvent):void {
	switch (e.target) {
		case buttonA :

			variables.Answer="A";//or whatever you want


			// etc etc
		case buttonB :

		case buttonC :

		case buttonD :


	var urlRequest:URLRequest=new URLRequest("Write-to-DB.php");

	var urlLoader:URLLoader=new URLLoader  ;
	urlLoader.addEventListener(Event.COMPLETE, completeHandler);

	//send to server

function completeHandler(event:Event):void {
	//go to next question here
	//handle the response from the server...

Open in new window

Christopher CaseySr Systems AdministratorAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

i'm not getting the error you're referring but then again the code in the file you uploaded is not the same as the snippet you posted.
the error upon clicking the Next button

TypeError: Error #1010: A term is undefined and has no properties.
      at Untitled_fla::MainTimeline/onNextClick()

seems to be a problem in here

arrQuestions[currentQuestion].visible = true;
can't check what's going on with where you're pushing and adding the questionForm to the stage without the xml format but it concerns me a bit that you're adding it in a for loop.

I can't check your source file now, but what the error message is saying is that the onNextClick() function requires one argument but you are not providing it in this line...

Maybe the onNextClick() function takes an Event as an argument???  If that is the case, change it to something like this to get away with it... (It's not a good way of doing it, but that should get you going...
   function onNextClick(e:Event = null):void

If that does not work, post the code for the onNextClick function...

Christopher CaseySr Systems AdministratorAuthor Commented:
O i am sorry i forgot to all the xml file and blue-genie your right i did upload the wrong flash file
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

Christopher CaseySr Systems AdministratorAuthor Commented:
Here is the code other bit of the code.

This works it hides the questions i will have to thank other experts-exchange Genius for all the code.

what i want to do is when the user press a,b,c,d it jumps to the next questions.
//load the questions
var urlLoader:URLLoader = new URLLoader();
urlLoader.addEventListener(Event.COMPLETE, onLoad);
urlLoader.load(new  URLRequest("Questions.xml"));

var arrQuestions:Array = []; 		//will contain all the questionForms for easy access
var objAnswers:Object = {};			//track all answers given
var currentQuestion:Number = -1; 	//The current displayed question

function onLoad(e:Event):void {
	var xml = new XML(e.target.data);
	var questions:XMLList = xml..Question;
	var questionCount:Number = questions.length();
	for(var i=0; i<questionCount; i++){
		//create instances of QuestionForm for each question.
		var questionForm:QuestionForm = new QuestionForm();
		//populate with text
		questionForm.question.text = questions[i].text();		
		questionForm.optionA.text = questions[i].Answer[0].text();
		questionForm.optionB.text = questions[i].Answer[1].text();
		questionForm.optionC.text = questions[i].Answer[2].text();
		questionForm.optionD.text = questions[i].Answer[3].text();
		questionForm.x = (stage.stageWidth /2) - (questionForm.width /2);
		questionForm.y = (stage.stageHeight /2) - (questionForm.height /2);
		questionForm.ID = questions[i].@id; //pulled from the id attribute in the xml file

function hideAllQuestions(){
	for(var i in arrQuestions) arrQuestions[i].visible = false;

//Next Button functionality
function onNextClick(e:MouseEvent):void{
	currentQuestion ++;
	if(currentQuestion == arrQuestions.length) currentQuestion = 0; //restart - or change to show 'end screen'
	arrQuestions[currentQuestion].visible = true;
btnNext.addEventListener(MouseEvent.CLICK, onNextClick);

//Demonsrates how to access all answers
function traceAnswers():void{
	for(var i in arrQuestions){
		if(arrQuestions[i].answer) trace("Question:" + arrQuestions[i].ID + " Answer:" + arrQuestions[i].answer);

Open in new window

Did you try what I have asked???  

Oh, I see it now...  ;)

Change that line to this and see if it does anything to get rid of the error message...

   function onNextClick(e:MouseEvent = null):void{


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Christopher CaseySr Systems AdministratorAuthor Commented:
Yes changing  function onNextClick(e:Event = null):void  worked.

why ?
Christopher CaseySr Systems AdministratorAuthor Commented:
I put  function onNextClick(e:MouseEvent = null):void{

and it still worked again why
Christopher CaseySr Systems AdministratorAuthor Commented:
Thank you
It should really be MouseEvent rather than Event...  It works because of the parent-child relationship between two...  But you really need to use MouseEvent for it...

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.