flex游戏引擎(PushButton)直接访问其它组件
直接访问其它组件,使用通用接口或直接访问
If all else fails, you can directly access another component, either using a common interface or directly.
There are three methods to directly access a component in an entity. Use owner for your own entity, or lookup and use another entity to get components from somewhere else. The methods:
lookupComponentByName which looks up a single named component and returns it. lookupComponentByType which looks up a single component by type and returns it. lookupComponentsByType which finds all components that match the specified type.Here's a simple example of directly accessing another component:
???These functions are cheap, and calling them once a tick won't slow anything down. However, if you do need to store a permanent reference to a component, make sure to clear and re-establish it when onReset() is called. Otherwise, you may access stale data(无效陈旧数据) or cause a memory leak(内存泄露).
?????PBE.registerType(com.pblabs.rendering2D.DisplayObjectRenderer);