主题:  我有几点疑问

wangjinran

职务:普通成员
等级:1
金币:0.0
发贴:8
注册:2001/6/17 7:09:03
#12001/6/17 7:19:45
我对flash共享库中的“smart clip”中的“RadioButton”的有几点疑问。
1、在代码中有“child.gotoandstop(4)”这类话,为什麽必须加“child.”,不能改为“this.”,而“stop()”又不能加“child.”,却可以加“this.”。
2、以后再问...

以下是代码:
onClipEvent(load) {
// check style preference
if (_parent.style.toUpperCase() == "AUTO") {
playerVersion = getVersion();
_parent.platform = playerVersion.substr(0, 3);
} else {
_parent.platform = _parent.style.toUpperCase();
}

// create methods for the parent class
_parent.child = this;

_parent.getLabel = function () {
return child.label;
}

_parent.getState = function () {
return child.checked;
}

_parent.isRadioButton = function () {
return true;
}

_parent.setLabel = function (label) {
child.label = label;
}

_parent.setState = function (state) {

if (state) {
// turn off all of the buttons
for (var tmp = head; tmp != null; tmp = tmp.next)
tmp.setState(false);

// now turn on ours
if (platform == "MAC") {
child.gotoandstop(4);
} else {
child.gotoandstop(2);
}
} else {
if (platform == "MAC") {
child.gotoandstop(3);
} else {
child.gotoandstop(1);
}
}
child.checked = state;
}

// set the initial state
stop();
label = _parent.label;

_parent.head = _parent; // make our parent the start
_parent.head.next = null; // init the next ptr to null
var obj = _parent._parent; // point to the object where the radio butons are instattiated

// link all of the radio buttons
for (var i in obj) {
// check to see that the container is a radio button
// and make sure the container is not our container
if (obj[i].isRadioButton() && obj[i] != _parent) {
var rButton = obj[i];

rButton.head = this._parent;
rButton.next = _parent.head.next;
_parent.head.next = rButton;
}
}

if (_parent.checked.toLowerCase() == "true") {
_parent.setState(true);
} else {
_parent.setState(false);
}
}

onClipEvent(mouseDown) {
if (hitTest(_root._xmouse, _root._ymouse, false)) {
if (_parent.getState()) {
_parent.setState(false);
} else {
_parent.setState(true);
}
updateAfterEvent();
}
}

编辑历史:[这消息被wangjinran编辑过(编辑时间2001-06-17 07:21:14)]


闪客作家

职务:普通成员
等级:1
金币:10.0
发贴:275
注册:2001/3/1 5:54:52
#22001/6/17 16:28:30
父辈路径当然不是THIS



闪客作家

职务:普通成员
等级:1
金币:10.0
发贴:275
注册:2001/3/1 5:54:52
#32001/6/17 16:39:38
不好意思,
恶心人,
代码挺乱的,
同一级的路径他用PARENT。CARDY=THIS来表式应该是对的吧,
可能因为不是自身只是同一级的,
太乱了看不大清,



wangjinran

职务:普通成员
等级:1
金币:0.0
发贴:8
注册:2001/6/17 7:09:03
#42001/6/17 18:08:24
共同研究,麻烦再看看。



青蛙小子

职务:普通成员
等级:1
金币:1.0
发贴:208
注册:2001/2/13 3:09:58
#52001/6/17 20:14:02
头都大了!死了好多老细胞!!!!



闪客作家

职务:普通成员
等级:1
金币:10.0
发贴:275
注册:2001/3/1 5:54:52
#62001/6/17 20:36:00
没有源程序这东东很难看的,
好像在同一级目录中放置了很多的东东,
然后互相调用,
不知道都是些什么,
搞不清,



wangjinran

职务:普通成员
等级:1
金币:0.0
发贴:8
注册:2001/6/17 7:09:03
#72001/6/18 7:06:59
我对flash共享库中的“smart clip”中的“RadioButton”的有几点疑问。
〈〈〈〈〈
是flash自带的。



wangjinran

职务:普通成员
等级:1
金币:0.0
发贴:8
注册:2001/6/17 7:09:03
#82001/6/20 10:41:20
再问一次。