i’m having a hard time understanding custom events and I keep getting this same error:
1203: No default constructor found in base class flash.events:Event.
I tried to read online for a solution, but nothing helped me. I was wondering what is my error. Basically, what I want to do is create a class that will, depending of the level of difficulty (3 in total), create different objects on the scene. Here’s the code:
I call it with a dispatchEvent like so:
dispatchEvent(new creationObjets(_Difficulte));
then,
package cem{
import flash.events.*;
import flash.display.*;
public class creationObjets extends Event
{
public function creationObjets(pDifficulte) {
trace(pDifficulte);
}
}
}
I have no idea what i’m not doing wrong (or just what I am doing, period… haha).
If you know the answer, maybe a little explication would help me a lot!
Thank you!
*edit: i just added super(pDifficulte); after the trace and no error came. I have no idea what super() does. I just did that based on examples…
You should do something like this:
The
super()method calls the constructor of the Event class. You should be familiar with it if you have some knowledge about OOP. The C# equivalent isbase()