typeof is handy but can be a little too flimsy at times.
Basically all it really understands are only six possible values;
If you want to run a conditional to check if you’ve got some common ethnic group, such as a
movieclip, on your hands then it works charms… BUT if you want to use
typeof to check for a
Text Field, or maybe something more exciting, then it’ll fail.
At least I know of no other way…
Today’s super simple code blurb of the day is:
The above loops through all nested
movieclips inside of a
parent movieclip and then checks what content is a text field. If it is then do what needs to be done… In this case just
trace is just what you do if you’re at a loss of what to do… ok!? Don’t judge me!
(clips.toString() == '[object TextField]') is the bit that you probably came googling here for. You can substitute
clips for whatever the hell you need to check against. The above looping through the children movieclips is just for added karma points.
You have gained karma reading this.
You now have enough to confront the grue.