Sunday, April 4, 2010

Passing argument to, when using one...

I had a class that I was passing a simple argument to like so:

var quiz_1_2:CaseStudyQuiz = new CaseStudyQuiz(2);

addChild(quiz_1_2);

I now would like to use this class for multiple MCs in my library. I thought I could let Flash create a class for each of them and specifying the CaseStudyQuiz class as the Base class. When I do that, I get the following error:

1136: Incorrect number of arguments.?Expected 0.

Obviously this is because the class created by flash does not except an argument. Does that mean, I would have to create a seperate class for each of the movies that use that class? And if so, what would I have to do in that class for it to except the parameter and pass it on to my base class?

Thank you very much for any help with this!!!

Passing argument to, when using one...

use the super() function and pass your parameter.?but you still might get a runtime error but i don't think that will cause a problem.

No comments:

Post a Comment