开发者

Check actionscript 3 variable type?

i have two objects [object MovieClip] [object ContentDisplay] i have to differentiate them abut i can't find a me开发者_运维问答thod in as3 check variable type, like in php have is_int...


getQualifiedClassName(obj); returns class name of given object

You can also check if object is for example a movieclip: if (obj is MovieClip) {/* do something */}


A similar strategy to is_int() would be to use the is keyword like this:

var mc:MovieClip = new MovieClip();

trace(mc is MovieClip); // true
trace(mc is String); // false
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜