as3: this,stage,root的测试
2010-07-11 21:22
267 查看
在不使用文档类(document class)的情况下,直接在时间轴上写以下代码:
输出:
this->[object MainTimeline] ,root->[object MainTimeline] ,stage->[object Stage]
this==root? --> true
this.stage==stage? --> true
0
同样的代码,如果放在有文档类(比如Test2.as)的环境中测试(构造函数中),输出如下:
this->[object Test2] ,root->[object Test2] ,stage->[object Stage]
this==root? --> true
this.stage==stage? --> true
0
很明显:没有文档类时,this就是指主时间轴;而在有文档类时,this就是文档类自身的实例;另外不管在哪种条件下 this与root都是等同的,this.stage也stage也是相同的。
trace("this->" + this,",root->" + root,",stage->" + stage); trace("this==root? -->",this==root); trace("this.stage==stage? -->",this.stage==stage); trace(numChildren);
输出:
this->[object MainTimeline] ,root->[object MainTimeline] ,stage->[object Stage]
this==root? --> true
this.stage==stage? --> true
0
同样的代码,如果放在有文档类(比如Test2.as)的环境中测试(构造函数中),输出如下:
this->[object Test2] ,root->[object Test2] ,stage->[object Stage]
this==root? --> true
this.stage==stage? --> true
0
很明显:没有文档类时,this就是指主时间轴;而在有文档类时,this就是文档类自身的实例;另外不管在哪种条件下 this与root都是等同的,this.stage也stage也是相同的。
相关文章推荐
- [AS3]root,this,stage关系
- [转]AS3中root,this,stage关系
- as3中使用stage ,root ,this 区别详解
- (转)AS3中的stage,this,root的区别
- AS3中root,this,stage关系
- [AS3]root,this,stage关系
- flash中stage,document,root以及this的区别应用
- flash中Stage,stage,root和this的区别用法
- flash中Stage,stage,root和this的区别用法
- 从多方查找资源并测试终于解决了问题,特记录下。 其实如果在安装的时候,正确的安装,就不会出现下面的信息了. 如在Linux下安装,提示密码的时候,输入Root账号的密码就不会出现这个问题了!
- AS3匿名函数的this指向
- This application is currently offline. To enable the application, remove the app_offline.htm file from the application root directory.
- Authentication method password not supported by the server at this stage
- 编译错误you should not run configure as root (set FORCE_UNSAFE_CONFIGURE=1 in environment to bypass this
- 孙鑫视频教程《深入学习window》里第三章的this指针小测试程序
- 彻底地/ 终于地, 解决 关于apache 权限的问题了:: 修改 DocumentRoot后的 403错误: have no permission to access / on this server
- "you need to be root to perform. this command"问题
- as3 addChild,addChildAt 测试
- Mac环境下mysql初始化密码问题--If you lose this password, please consult the section How to Reset the Root Password in the MySQL reference manual.
- 无需root手机,得到robotium运行的测试报告