Bill
Bill

Reputation: 19318

Check actionscript 3 variable type?

i have two objects [object MovieClip] [object ContentDisplay] i have to differentiate them abut i can't find a method in as3 check variable type, like in php have is_int...

Upvotes: 3

Views: 2820

Answers (2)

Marty
Marty

Reputation: 39466

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

Upvotes: 3

Bartek
Bartek

Reputation: 1996

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 */}

Upvotes: 8

Related Questions