Firstly, something I want to explain is I am not familiar with ActionScript, so don't blame me a lot for some basic mistakes. I have just learned it for a short time only. Thus, a few tips of scripting ActionScript is always appreciated. :)
I don't know why the compiler said the constructor of one of my classes doesn't accept any parameter.
OK. You might get my meaning through code shown below.
Here a Player.as:
public class Player extends Sprite
{
public var mcHealthBar:HealthBar;
public function Player()
{
// Here a compiler error is found.
mcHealthBar = new HealthBar(max_health);
}
}
and also a HealthBar.as:
public class HealthBar extends MovieClip
{
private var max_hp:int;
public function HealthBar(MaxHP:int)
{
// constructor code
max_hp = MaxHP;
}
}
The compiler said HealthBar's constructor could not be used with arguments, but you can clearly see the HealthBar() constructor inside the HealthBar.as has already been written with a argument MaxHP.
Lastly, what i want to ask is, why the compiler error was produced?
NOTE: I am coding by using Flash-Builder and Flash-Professional together. I created a Flash-Professional project through Flash-Builder. I draw by using Flash-Professional, and I code by using Flash-Builder.
There may be some grammatically-wrong English mistakes... So I am very sorry for my very bad English lol...