|
主题: Flash MX - 新的闪烁世界 第十天
|
 Demon.S
职务:版主
等级:5
金币:10.0
发贴:2468
注册:2000/9/15 13:56:49
|
#312002/3/11 18:39:31
en,if not defined.
|
 torain
职务:普通成员
等级:1
金币:0.0
发贴:33
注册:2000/12/1 17:05:57
|
#322002/3/11 19:08:42
画魔在上个帖子中说 引用: en,if not defined.
but i tried times and times and found that "void (mc) == undefined" is always true whether mc is predefined or not.
|
 Demon.S
职务:版主
等级:5
金币:10.0
发贴:2468
注册:2000/9/15 13:56:49
|
#332002/3/11 20:09:30
ok,try this:
for (i=2; i>=0; i--) { if (mc == undefined) { trace(void(mc)); _root.createEmptyMovieClip("mc", 1); } }
|
 rabt
职务:普通成员
等级:1
金币:0.0
发贴:18
注册:2002/3/11 20:30:46
|
#342002/3/11 20:31:43
goooooooooooooood!
|
 torain
职务:普通成员
等级:1
金币:0.0
发贴:33
注册:2000/12/1 17:05:57
|
#352002/3/11 20:35:23
(mc == undefined) returns true and then create "mc". it returns false in the next loop. So nothing in the output window. if i use the this code:
for (i=2; i>=0; i--) { if (mc == undefined) { _root.createEmptyMovieClip("mc", 1); } trace(void(mc)); }
three "undefined" in output window.
|
 chenlei5211
职务:普通成员
等级:1
金币:4.0
发贴:111
注册:2002/3/10 19:35:08
|
#362002/3/11 20:51:48
画魔在上个帖子中说 引用: 介于我服务器实在太慢:(,你如果是个人网站,可以转载并说明来源和作者,如果是媒体,请email跟我联系。
太谢谢你了!
|
 千风子
职务:普通成员
等级:1
金币:0.0
发贴:18
注册:2001/7/28 20:30:27
|
#372002/3/11 23:39:54
看这里: 这是FlashMX的参考,它指出undefined只有一个值那就是undefined。 undefined类似与null
undefined
Availability
Flash Player 5.
Usage
undefined
Parameters
None.
Returns
Nothing.
Description
A special value, usually used to indicate that a variable has not yet been assigned a value. A reference to an undefined value returns the special value undefined. The ActionScript code typeof(undefined) returns the string "undefined". ..The only value of type undefined is undefined
When undefined is converted to a string, it converts to the empty string.
The value undefined is similar to the special value null. In fact, when null and undefined are compared with the equality operator, they compare as equal.
Example
In this example, the variable x has not been declared and therefore has the value undefined. In the first section of code, the equality operator (==) compares the value of x to the value undefined and the appropriate result is sent to the Output window. In the second section of code, the equality operator compares the values null and undefined.
// x has not been declared trace ("The value of x is " + x); if (x == undefined) { trace ("x is undefined"); } else { trace ("x is not undefined"); }
trace ("typeof (x) is " + typeof (x)); if (null == undefined) { trace ("null and undefined are equal"); } else { trace ("null and undefined are not equal"); }
The following result is displayed in the Output window:
The value of x is x is undefined typeof (x) is undefined null and undefined are equal Note: In the ECMA-262 specification, undefined converts to the string "undefined", not the empty string. This is a difference between ActionScript and the ECMA-262 specification
编辑历史:[这消息被5D大叔编辑过(编辑时间2002-03-12 12:25:19)]
|
 5D非线性编辑版主
职务:版主
等级:4
金币:10.0
发贴:1505
注册:2004/1/29 12:09:56
|
#382002/3/12 0:10:28
torain在上个帖子中说 引用: (mc == undefined) returns true and then create "mc". it returns false in the next loop. So nothing in the output window. if i use the this code:
for (i=2; i>=0; i--) { if (mc == undefined) { _root.createEmptyMovieClip("mc", 1); } trace(void(mc)); }
three "undefined" in output window.
对啊,demon.s的只执行一次trace,你的trace要执行三次嘛
|
 torain
职务:普通成员
等级:1
金币:0.0
发贴:33
注册:2000/12/1 17:05:57
|
#392002/3/12 10:32:49
拜托各位老大想想: 我对 demons 的疑问在于 无论 名为 "mc " 这个 instance 存不存在, void( mc ) 始终等于 undefined. 所以: 引用:
if (void (mc) == undefined) {
_root.createEmptyMovieClip("mc",1);
}
这个条件语句,有用么? 后来 demons 举了这个例子: 引用:
for (i=2; i>=0; i--) { if (mc == undefined) { _root.createEmptyMovieClip("mc", 1); } trace(void(mc)); }
我觉得这个例子并不能证明 void(mc) 在 mc 存在与否的时候有不同。 Please be PROFESSIONAL ! 说的不对的请 各位老大指正 。
|
 Demon.S
职务:版主
等级:5
金币:10.0
发贴:2468
注册:2000/9/15 13:56:49
|
#402002/3/12 11:45:47
对,没有说void可以有什么效果,所以没有用void做条件,只是trace它的无意义的值。
|
 Demon.S
职务:版主
等级:5
金币:10.0
发贴:2468
注册:2000/9/15 13:56:49
|
#412002/3/12 19:08:16
updated.
|
 千风子
职务:普通成员
等级:1
金币:0.0
发贴:18
注册:2001/7/28 20:30:27
|
#422002/3/12 19:17:06
Demon.S 第五天的链接弄错了,链到第四天去了。
|
 东方楚楚
职务:普通成员
等级:1
金币:0.0
发贴:44
注册:2000/10/25 1:32:58
|
|
 东方楚楚
职务:普通成员
等级:1
金币:0.0
发贴:44
注册:2000/10/25 1:32:58
|
|
 东方楚楚
职务:普通成员
等级:1
金币:0.0
发贴:44
注册:2000/10/25 1:32:58
|
#452002/3/12 20:32:08
师父啊!你的米筐精彩极了!爆笑之余,还学到了不少东西。继续加油啊! 另个问个问题: txtUser.tabChildren=txtPass; 这句,我不知道有啥作用?去掉后运行依然正常。而且面板中找不到有tabChildren命令。给讲解一下行吗?
编辑历史:[这消息被东方楚楚编辑过(编辑时间2002-03-12 20:32:37)]
|