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:

  1. make hero publicly accessible. when create new hero (wherever is) can add public getter/setter methods allow external class access it.

  2. create "model" class can referenced singleton getinstance() pattern. proceed in (1).

  3. are sure sprite has been added stage? can check doing starling.current.stage.getchildbyname(hero); although need have access hero variable.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -