actionscript 3 - Compiling with unused and unavailable classes (like StageText on web) -


i have common codebase using export mobile (ios+android) desktop (osx+windows) , web (swf)

99% of code compatible everywhere, , works

however, there couple instances (like stagetext), won't work. in cases, want use different class (like textfield or tlftextfield). logically, fine... won't compile

i have like-

var mystagetext:stagetext; var myregulartext:textfield;  if(isair) { mystagetext = new stagetext(); } else { myregulartext = new textfield(); } 

how can let compile everywhere, without turning off error checking?

ah okay, realized can using wildcard object definitions , setting class name... like:

var textinput:*; var customclass:class;  if(isair) { customclass = getdefinitionbyname("flash.text.stagetext") class; textinput = new customclass(); textinput.stage = stage; } else { textinput = new textfield(); addchild(textinput } 

Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -