actionscript 3 init()

后端 未结 4 1130
[愿得一人]
[愿得一人] 2020-12-16 21:16

I have often seen an init() within the constructor of AS3 classes, sometimes even being the only code in the constructor. Why would it be useful to do this, if you could si

4条回答
  •  Happy的楠姐
    2020-12-16 21:57

    The reason I have done it is so that I can re-initialize a class without creating a new instance of it. The init() method works as basically a "reset" button then, if you code it right, allowing you to return the class to its initial state while, for instance, allowing any variables that have been set to remain set.

    Depending on how you code it, of course.

提交回复
热议问题