質問

Say I have a parent- and a child-object. At some point a variable (boolean) in the child changes and the parent needs to notice. Now, is it performance-wise cheaper to let the child dispatch an event once the variable has changed, or to have the parent check this childs variable every frame in an already existing enterFrameEventHandler?

役に立ちましたか?

解決

It is right. Event over loop check. But event better would be a callback. The event generation is heavy. If your variable or whatever changes quite often, then you would create a new Event instance every time a change happens.

Rob Penner wrode the library signals because of this problem:

https://github.com/robertpenner/as3-signals

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top