简体   繁体   中英

AS3 check if class name is

I want to know if a Class is the main stage, in other words...

if it is "ThisName" then...

My code is:

MainStage = this.parent as MovieClip;
trace("scroll Stage: " + MainStage); // output: scroll Stage: [object Main_Activate]

but how would I write it this way?

if(MainStage == [object Main_Activate])
then run my code.

In this last example [object Main_Activate] is getting errors.

您可以使用is运算符

if (this.parent is Main_Activate)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM