There is a library component represented by Class A. But constructor of this class requires some parameters.
When the component needs to be added dynamically, it’s fine because of code :
var abc:A = new A(param1,param2)
But what if my movieclip is already present on the stage. I notice it gives out error, that the parameters are null.
Is their any way to insert constructor parameters for movieclips already on stage.
Thanks
Vishwas, any symbols on the stage have already been instantiated. You cannot call their constructor again. Instead, try writing a public function in those classes that sets up the variables that you need. Internally, if those variables are not set, you can toggle the visibility to false and wait, or just not process anything. Once they are set, your clips are off and running again.
Then, in addition to calling the public function on the clips on the stage, you can add optional parameters to the constructor for those instances you’ll create via code, not the Flash IDE. If the parameters exist in the constructor, just go ahead and call the function right there.