开发者

AS3: is-not keyword?

I can't seem to actually find a reference to 'is' in the AS3 documentation for type comparison other than in examples. Perhaps this can't be done, but it seems like there should be something for this scenario...

Right now I have:

if ( event.target is Class )
{           
}
else
{
    // What I really want to do!
}

This seems silly because what I really want to say is...

if ( event.target isNo开发者_开发百科t Class )
{
    // Sure would be cleaner!
}

Can I do that?


Why not just do:

if ( !(event.target is Class) )
{           
}


To get the class of an object:

var targetClass:Class = Object(event.target).constructor;

To test if target is not a textfield for example

if(Object(event.target).constructor != TextField){
   //not a textfield
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜