actionscript 3 - cannot getChildByName starling stage -
i trying reference object placed on starling stage named "_shooterhero" external class "bullet".
i have tried using getchildbyname with:
starling.core.stage
, starling.current.nativestage
, without luck
the code right now:
var hero= starling.current.stage.getchildbyname("_shooterhero"); trace (hero.name)
there few ways solve problem:
make hero publicly accessible. when create new hero (wherever is) can add public getter/setter methods allow external class access it.
create "model" class can referenced singleton getinstance() pattern. proceed in (1).
are sure sprite has been added stage? can check doing starling.current.stage.getchildbyname(hero); although need have access hero variable.
Comments
Post a Comment